Felipe
2007-Nov-10 00:54 UTC
[R] Need something like multiple plots in ts.plot but then change x values
Hi: I need to plot two data sets and then I need to change labels of xaxis. I can manage to achieve something like it with this: x<-data.frame(a=c(1,2,3,4,5),b=c(2,4,6,8,10)) y<-data.frame(a=c(3,4,5),b=c(1.5,2,2.5)) xts <- ts(x$b,start=x$a[1]) yts <- ts(y$b,start=y$a[1]) ts.plot(xts,yts,col=c("red","blue")) But ts.plot does not allow to change x labels. Besides, i need dots. That's the cause I would lke to know if there is some way to trick plot to do this. Thanks in advance. -- Felipe [[alternative HTML version deleted]]
Gabor Grothendieck
2007-Nov-10 01:12 UTC
[R] Need something like multiple plots in ts.plot but then change x values
Try this: ts.plot(xts,yts,col=c("red","blue"), gpars = list(axes = FALSE)) axis(2) axis(1, 2:10/2, letters[2:10]) On Nov 9, 2007 7:54 PM, Felipe <felipenaranja at gmail.com> wrote:> Hi: > > I need to plot two data sets and then I need to change labels of xaxis. I > can manage to achieve something like it with this: > > x<-data.frame(a=c(1,2,3,4,5),b=c(2,4,6,8,10)) > y<-data.frame(a=c(3,4,5),b=c(1.5,2,2.5)) > xts <- ts(x$b,start=x$a[1]) > yts <- ts(y$b,start=y$a[1]) > ts.plot(xts,yts,col=c("red","blue")) > > But ts.plot does not allow to change x labels. Besides, i need dots. That's > the cause I would lke to know if there is some way to trick plot to do this. > > Thanks in advance. > > -- > Felipe > > [[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. >