Closed robjhyndman closed 3 years ago
Thanks. This is due to a leap year in the data, causing an off-by-one when the dates are aligned to a fixed origin. I've made a smarter fix for the scale_x_year* tsibble classes now which retains the tsibble class in the plot.
This should be easier/better with origin agnostic/optional time classes in a future package.
Now it gives a quarterly time axis for monthly data.
library(tsibble)
library(feasts)
#> Loading required package: fabletools
USAccDeaths %>% as_tsibble() %>% gg_season(value)
Created on 2020-08-25 by the reprex package (v0.3.0)
It also requires library(tsibble)
or it fails to find scale_x_yearmonth
.
The breaks (Q1-Q4) should be improved in tsibble's scale_x_yearmonth()
defaults, and there isn't a nice way to fix this in feasts (as the tsibble scale functions don't pass ...
through to pretty()
, https://github.com/tidyverts/tsibble/issues/216)
I'll fix the scoping issue.
I've added a fallback to date for the breaks for now, which gives the desired result:
library(feasts)
#> Loading required package: fabletools
USAccDeaths %>% as_tsibble() %>% gg_season(value)
Created on 2020-08-25 by the reprex package (v0.3.0)
See December in the following.
Created on 2020-08-24 by the reprex package (v0.3.0)