在扇形图中R与其他包比fanplot

时间:2015-12-17 15:09:24

标签: r shiny dygraphs rcharts

我通常会创建一个这样的粉丝图:

n.ahead <- 10
m <- matrix(,nrow = 5000,ncol = 10)

library(fanplot)
m[,1] <- rnorm(5000,0.01,sd = 0.005)
m[,2] <- rnorm(5000,0.02,0.006)
m[,3] <- rnorm(5000,0.03,0.008)
m[,4] <- rnorm(5000,0.04,0.01)
m[,5] <- rnorm(5000,0.06,0.013)
m[,6] <- rnorm(5000,0.1,0.015)
m[,7] <- rnorm(5000,0.11,0.02)
m[,8] <- rnorm(5000,0.13,0.025)
m[,9] <- rnorm(5000,0.14,0.05)
m[,10] <- rnorm(5000,0.18,0.07)

n.ahead <- 10
fancol <- colorRampPalette(c('black', 'white'))
plot(
  NULL, type = 'n', lwd = 3, col = 'black',
  xlim = c(0, n.ahead), ylab = 'Y', ylim = c(0,max(m)), xlab = 'Year',
  las = 1, xaxt = 'n', main = 'Y'
)
fan(
  m, fan.col = fancol, ln.col = 'grey', txt = c('90','95', '99'),
  anchor = 0, frequency = 1, probs = c(seq(1, 99, 1), 99.9, 99.95, 99.99), ln =
    c(50, 90, 99, 99.9, 99.95, 99.99)
)
axis(1, at = 0:n.ahead, tcl = 0.5)
axis(1, at = seq(0, n.ahead, 0.25), labels = FALSE, tcl = 0.25)

在创建fanlplot的意义上它起到了作用。但是,我不是很喜欢它。是否有我们在dygraphsrCharts中看到的动态图表的替代品我可以在Shiny中使用?

感谢。

0 个答案:

没有答案