Historical actuals as a solid line, the forecast dashed, and one or two nested confidence ribbons.

geom_forecast_band(mapping = NULL, data = NULL, color = NULL, linewidth = NULL)

Arguments

mapping, data

Standard layer overrides. Map time to x, the value to y, the interval to ymin/ymax, and the actual-vs-forecast split to group.

color

Line color.

linewidth

Line width.

Value

A Layer to add with +.

Examples

d <- data.frame(
  t = 1:10, v = c(1:6, 7, 8, 9, 10),
  lo = c(rep(NA, 6), 6, 6.5, 7, 7.5),
  hi = c(rep(NA, 6), 8, 9.5, 11, 12.5),
  part = rep(c("actual", "forecast"), c(6, 4))
)
ggnext(d, aes(t, v, ymin = lo, ymax = hi, group = part)) +
  geom_forecast_band()
#> <ggnext plot>
#>   data:  10 x 5
#>   aes:   x = t, y = v, ymin = lo, ymax = hi, group = part
#>   layers: 1 
#>   coord: cartesian
#>   mode:  static