I am working on a Vector Autoregression using the forecast package, and I am trying to clean up the final plots.
The standard forecast plot is done by the following command:
fcast1 <- forecast(var2, h=8)
autoplot(fcast1)
It yields a nice plot below:
What I would like to do is just show the period from 2018 onward. However, it seems as if the dates have been converted to decimal years. So, the only way to expand it is the following:
f <- forecast(var2, h=8) %>% autoplot() + coord_cartesian(xlim = c(2019.0,2019.75))
f
This yields the plot with the x-axis in decimal years.
Is there any way to access the dates or convert them from decimals? I have tried accessing the data in the f plot using f$data$x <- as.Date(f$data$x) but this does not help.
Also, I tried wrapping the limits in the lubridate::date_decimal() command and no such luck. I can see that that index in the var2 object is in my weekly date format.
