Q: When faceting by model, how can I stop fabletools::autoplot()
from using the color aesthetic for models?
This is related to the question Facet a fabletools autoplot of a fable forecast by model. There was a great hack proposed in the comments. I replicate it below. But I don’t imagine this is what the authors of fable
intended. What’s the non-hack approach?
I’m kind of struggling to understand how fabletools::autoplot()
thinks about plotting, even after going through documentation and a debugging session. I think an answer to my specific question above will end up resolving some of my general struggles in understanding.
library(tidyverse)
library(tsibble)
library(feasts)
library(fable)
library(fabletools)
tourism_melb <- tourism %>%
filter(Region == "Melbourne") %>%
filter(Purpose == "Business") %>%
select(-Region, -State, -Purpose)
fableModels <- tourism_melb %>%
model(arima = ARIMA(), tslm = TSLM(Trips ~ trend()), mean = MEAN(window = 4))
forecasts <- fableModels %>%
forecast(h = "2 years")
forecasts %>% autoplot(tourism_melb) + facet_wrap(~.model, ncol = 1) +
# the great hack
scale_fill_manual(values = rep(NA, 3), aesthetics = c("color", "fill"), guide = "none")