I'm trying to plot some prices vs dates. There are about 10k lines of data. The dates are a range from ~ 7/1/2008 - 12/1/2011. I'd like to be able to create a custom x-axis with the following ticks on it for each year:
1) at 1/1 have the YYYY (ie 2011
)
2) at 4/1 have the abbreviation of the month (ie Apr
)
3) at 7/1 have the abbreviation of the month (ie Jul
)
4) at 10/1 have the abbreviation of the month (ie Oct
)
Here's a description of the data:
> head(as.POSIXct(rs4p[,3]))
[1] "2008-06-30 20:00:00 EDT" "2008-06-30 20:00:00 EDT"
[3] "2008-06-30 20:00:00 EDT" "2008-06-30 20:00:00 EDT"
[5] "2008-06-30 20:00:00 EDT" "2008-06-30 20:00:00 EDT"
> head((rs4p[,3]))
[1] "2008-07-01" "2008-07-01" "2008-07-01" "2008-07-01" "2008-07-01"
[6] "2008-07-01"
> min((rs4p[,3]))
[1] "2008-07-01"
> max((rs4p[,3]))
[1] "2011-12-08"
> class((rs4p[,3]))
[1] "Date"
UPDATE:
One other thing I forgot is that when the graph is done I'd like to put a grid()
over the plot. Is there a way to make the grid lines correspond to the year ticks?