5

I generally create a fanplot like this:

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)

It does the trick in the sense that a fanlplot is created. However, I don't really like it. Are there alternatives with dynamic charts like we see in dygraphs and rCharts I can use in Shiny?

Thanks.

user5249203
  • 4,436
  • 1
  • 19
  • 45
Tim_Utrecht
  • 1,459
  • 6
  • 24
  • 44

0 Answers0