I have the following data:
x=strptime(20010101:20010110)
y=1:10
z=data.frame(x,y)
So my data is this:
x y
1 2
The function axis draws your axes, tick marks and labels, and returns the tick mark positions as a vector.
Since you have Date data, you need to use axis.Date to do this, and then use abline to plot the grid:
z=data.frame(
x=seq(as.Date("2001-01-01"), by="+1 month", length.out=10)
y=1:10
)
plot(y~x, data=z)
abline(v=axis.Date(1, z$x), col="grey80")
