Here is the link to the original problem. Briefly, I was unable to plot a custom x-axis showing abbreviated months in a time series plot of a zoo object.
In the plot.zoo()
function set
xaxt = "n"
to suppress plotting of the x-axis
Since I needed abbreviated months to be plotted as the x-axis, I loaded a csv file with the dates of the first of each month as follows and converted it to dates:
“month”
2004-12-01
2005-01-01
2005-02-01
…
(I included Dec 2004, because otherwise “Jan” would not be plotted)
month < - read.csv("~/R/2005months.csv")
month$month < - as.Date(month$month, "%Y-%m-%d")
After the plot.zoo
command I added the following line –
axis(1, month$month, format(month$month, "%b"))
The solution was inspired by a post from Gabor Grothendieck on r-help. The original solution is still the only way to plot abbreviated months for time series plots of monthly averages.