[R] Need something like multiple plots in ts.plot but then change x values

Gabor Grothendieck ggrothendieck at gmail.com
Sat Nov 10 02:12:49 CET 2007


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.
>



More information about the R-help mailing list