[R] plot overlay of several times from the same month (but from different years) with formatted axis

Max Rausch maxrausch at gmail.com
Fri Oct 3 16:18:21 CEST 2008


 I have searched the forums but I am having trouble trying accomplish a
specific plot. I am not sure if this is a very basic task but I am having a
lot of trouble Here is my data frame:

        date        production       price
1  2003-08-15      12050       4.83
2  2003-08-18      12050       4.94
3  2004-08-10      12300       5.78
4  2004-08-11      12300       5.64
5  2004-08-12      12300       5.46
6  2004-08-13      12300       5.27
7  2004-09-03      12300       4.33
8  2004-09-07      12300       4.41
9  2004-09-13      12300       5.12
10 2004-09-14      12300       5.15

The first plot that I am trying to do is plot the daily price data for every
September over 5 years on one graph. The following command will plot the
data for first year (for example sept-2003)  and then format the axis the
way that I want to, but I can not figure out how to add sept-2004, sept-2005
(on the same graph), etc.

plot(as.POSIXct(date), price, type = "l", lty = 1, col = "dark
blue",ylab="price",xaxt = "n", xlim=c(start_date,end_date))
axis.POSIXct(1, at=seq(start_date, end_date, by= interval), format=
date_format)



More information about the R-help mailing list