我曾尝试 highcharter 画多元时间序列图
library(highcharter)
Registered S3 method overwritten by 'xts':
method from
as.zoo.xts zoo
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Highcharts (www.highcharts.com) is a Highsoft software product which is
not free for commercial and Governmental use
class(EuStockMarkets)
[1] "mts" "ts" "matrix"
我注意到 plot 方法里,包含对 ts
对象的支持,所以 plot(EuStockMarkets)
我也注意到 hchart
应该是支持 mts
和 ts
数据类型的画图
methods(hchart)
[1] hchart.acf* hchart.character* hchart.data.frame*
[4] hchart.default* hchart.density* hchart.dist*
[7] hchart.ets* hchart.factor* hchart.forecast*
[10] hchart.glm* hchart.histogram* hchart.igraph*
[13] hchart.matrix* hchart.mforecast* hchart.mts*
[16] hchart.numeric* hchart.prcomp* hchart.princomp*
[19] hchart.stl* hchart.survfit* hchart.tibble*
[22] hchart.ts* hchart.xts*
see '?methods' for accessing help and source code
但是,当我尝试这样画图的时候,就报错了,不知是不是我调用出错了,还是这个包本身不支持
hchart(EuStockMarkets)
Error in as.Date.ts(.) : unable to convert ts time to Date class
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] highcharter_0.7.0.9000
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 pillar_1.4.2 compiler_3.6.1 xts_0.11-2
[5] prettyunits_1.0.2 remotes_2.1.0 tools_3.6.1 digest_0.6.20
[9] pkgbuild_1.0.4 lubridate_1.7.4 jsonlite_1.6 tibble_2.1.3
[13] nlme_3.1-141 lattice_0.20-38 pkgconfig_2.0.2 rlang_0.4.0
[17] igraph_1.2.4.1 cli_1.1.0 yaml_2.2.0 curl_4.0
[21] stringr_1.4.0 withr_2.1.2 dplyr_0.8.3 generics_0.0.2
[25] htmlwidgets_1.3 rprojroot_1.3-2 grid_3.6.1 tidyselect_0.2.5
[29] data.table_1.12.2 glue_1.3.1 R6_2.4.0 processx_3.4.1
[33] TTR_0.23-4 callr_3.3.1 purrr_0.3.2 tidyr_0.8.3
[37] magrittr_1.5 backports_1.1.4 ps_1.3.0 htmltools_0.3.6
[41] rlist_0.4.6.1 quantmod_0.4-15 assertthat_0.2.1 stringi_1.4.3
[45] broom_0.5.2 crayon_1.3.4 zoo_1.8-6
highcharter 包 <https://github.com/jbkunst/highcharter> 和图库 <http://jkunst.com/highcharter/>