Maximilian Rausch
2008-Oct-01 16:37 UTC
[R] plotting several yearly/monthly time series on the same plotting several yearly/monthly time series on the same graph
I have searched the forums but I am having trouble trying accomplish two
specific plots. 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 prod_daily 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), formatdate_format)
The second graph that I would like to accomplish is a scatter plot of
prod_daily vs price. But I would like to have it only do the scatter plot
for the month of September over 5 years. The following command will just do
a scatter over the whole 5 years, but am not sure how to modify it so that
it only shows September (or another specific date range) over each year
plot(price, production)
[[alternative HTML version deleted]]
