I'm trying to get some sensible labels on a forecast.
Here's my code:
library("forecast")
t <- ts(
c(
4410.0, 6435.0,
4939.0, 6487.0, 25521.0, 18764.0,
12223.0, 18590.0, 36898.0, 28826.0,
20329.0
)
, frequency = 4
, start=c(2011, 7, 1)
)
cast <- meanf(t,h=4)
par(mfrow=c(1,1),xaxt="n")
plot(cast)
ticks <- seq(as.POSIXct("2011-07-01"), by = "3 month", length.out=length(cast) + 4)
axis.Date(1, at = ticks, labels = ticks, format="%Y-%m")
There are no errors or warnings... but no axis gets added to the plot :(
If I use xaxt="s"
then I do get axis labels, but they're not they're things like 2014.0 (i.e. not formatted as dates at all). Ideally I'd actually like something a bit more readable like "Q3 2014" but I'd settle for 2014-07 (the first month in the quarter).
Any idea what I'm doing wrong? All of the stuff I've found searching the internet suggests disabling the default axis and then using the axis or axis.Date functions to add a custom on... but I can't get an axis of any sort using either of those methods :(