使用R中的Dygraphs的上/下条

时间:2017-10-17 23:10:43

标签: r dygraphs

我想使用Dygraphs库为R绘制像这样的图表。

Time Series charts with upper/lower bars

我的数据类似于以下数据框

> tail(DfDygraphPredictionObservedComps)

     Observed SLPrediction SLUpBand SLDwBand MLPrediction MLUpBand MLDwBand LLPrediction LLUpBand LLDwBand
2017-09-13   3.1351     3.120882 3.160430 3.109770     3.083619 3.180162 3.090038     3.085003 3.180162 3.090038
2017-09-14   3.1205     3.108331 3.145396 3.095604     3.077570 3.167217 3.073783     3.077475 3.167217 3.073783
2017-09-15   3.1104     3.113845 3.135238 3.085562     3.071449 3.157525 3.063275     3.073205 3.157525 3.063275
2017-09-18   3.1362     3.136071 3.160843 3.111557     3.081938 3.185797 3.086603     3.083608 3.185797 3.086603
2017-09-19   3.1360     3.134385 3.160354 3.111646     3.089192 3.186842 3.085158     3.091294 3.186842 3.085158
2017-09-20   3.1349     3.127217 3.158492 3.111308     3.090491 3.187005 3.082795     3.071906 3.187005 3.082795

我尝试使用下面的代码执行图表,但每个上部/波段和系列的颜色都不起作用

dygraph(DfDygraphPredictionObservedComps) %>% 
  dySeries(c("Observed"), label = "Observed") %>%
  dySeries(c("SLDwBand", "SLPrediction", "SLUpBand"), label = "SLPrediction") %>%
  dySeries(c("MLDwBand", "MLPrediction", "MLUpBand"), label = "MLPrediction") %>%
  dySeries(c("LLDwBand", "LLPrediction", "LLUpBand"), label = "MLPrediction") %>%
  dyRangeSelector()

韩国社交协会!! :)

0 个答案:

没有答案