[R] Multiple time series plots

From: Kerpel, John <John.Kerpel_at_infores.com>
Date: Wed, 02 Jul 2008 09:54:14 -0500


Hi all:  

I'm trying to plot two time series created in Rmetrics and label the x-axis with dates. I tried the following:  

dates <- as.Date(seriesPositions(x.agg))  

r <- as.Date(range(dates))  

ts.plot(x.agg_at_Data[,c(1,5)],gpars=list(ylab="Volume", lty=c(1:2),xaxt="n",main="Plot of Volume"))  

axis.Date(1, at=seq(r[1], r[2], length.out=10), format="%Y-%m-%d",cex.axis=.75)  

legend("bottomleft",legend=c("Base Volume","Model Base Volume"),lty=c(1,2),inset=.01,cex=.5,adj=0)  

All this works fine, except I don't get the dates on the x-axis like I want. When I try to plot a single series using "plot" it works as expected.  

Any advice?  

John

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 02 Jul 2008 - 15:41:28 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 17:31:48 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive