fpp3:: change level color (forecast plot)

In the following example, how can I change the colors of the legend i.e. the level? Currently, they are in grey; I want them to be colored just like the main plot. Thanks!

library(fpp3)

global_economy %>%
  filter(Code == "EGY") %>%
  model(ARIMA(Exports)) %>% 
  forecast(h=5) %>%
  autoplot()

Created on 2021-07-08 by the reprex package (v2.0.0)

What am I missing? Any help?

The colour levels for intervals are gray as they indicate 'shading', not colour. Darker intervals are 80%, and lighter intervals are 95%. This is particularly important when forecasts of more than one colour shade are provided.

@mitchelloharawild thanks for the reply.
I am considering only one model. Is it possible to match the colors of the intervals with the shading? That is, shading will get the color dark blue and light blue. If this is not possible, how about blue becomes grey. Thanks again for your help.

You can change the color to black with autoplot(color = "black"), but from a visual perspective this pushes the 95% regions into the background. Highlighting with color is too important to give up. Your audience should quickly figure out that the regions are differentiated by the shading in the legend irrespective of color.

Thanks @EconProf ! I find the color = "black" tip very helpful.

Can I conclude that it is not possible to make the shading blue even for a single model?

It is not possible at this time without hacking around with the ggplot legends (removing the level one, adding a dummy legend with the desired colours).

The next version of {fabletools} will likely have the legend fill colour match the interval fill colour. This is thanks to the {ggdist} package which I hope to use in the next release.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.