是否可以制作带有dygraphs的扇形图?

时间:2018-02-01 12:56:07

标签: r ggplot2 shiny dygraphs r-dygraphs

我想将一个图形中的多个下/值/上部样式系列与阴影条组合。是否可以创建?

例如,对于下面的xts对象“new_df”:

df <- data.frame("value" = c(1,2,3,4,5), "upper1" = c(1.2, 2.3, 3.1, 4.6, 5.9), "lower1" = c(0.5, 1.8, 2.6, 3.7, 4.9), "upper2" = c(1.2, 2.1, 3.5, 4.8, 5.9), "lower2" = c(0.3, 1.4, 2.7, 3.5, 4.8))
dates <- c("2014-10-01", "2014-11-01", "2014-12-01", "2015-01-01", "2015-02-01")
time <- as.Date(dates)
new_df <- as.xts(df, order.by = time)

这是new_df:

enter image description here

这是我想要获得的情节示例,但我希望在一个图表中获得多个 enter image description here

1 个答案:

答案 0 :(得分:1)

你在找这个吗?

dygraph(new_df, main = "testing") %>%
  dySeries(c("lower1", "value", "upper1"), label = "num1") %>% 
  dySeries(c("lower2", "value", "upper2"), label = "num2")