[R] simple ts plot question

Guido Masarotto guido at sirio.stat.unipd.it
Fri Mar 10 13:01:16 CET 2000


On Fri, Mar 10, 2000 at 09:09:58AM -0300, Francisco Cribari Neto wrote:
> 
> Hi, I have a simple question regarding plots of time series. I 
> have two time series, say ts1.ts and ts2.ts. They are both monthly. 
> The first one ranges from 1944:2 through 1999:7 whereas the second 
> one ranges from 1974:1 through 1993:6. How can I plot both of them 
> in the same plot (the shorther series would be only displayed in a 
> section of the x axis since it is shorter). 
> 
> My naive try was 
> 
> plot(c(ts1.ts, ts2.ts), xlab="time", ylab="")
> 
> but it did not work. Note: I have defined the two series as 
> 

  Try
  > plot(cbind(ts1.ts,ts2.ts),xlab="time", ylab="", plot.type="single")

  or better something like:
  > plot(cbind(ts1.ts,ts2.ts),plot.type="single",
  + col=c("yellow","red"),lty=c("solid","dotted")) #colours and patterns

  It can also be helpful to contrast 'c(ts1.ts,ts2.ts)' with
  'cbind(ts1.ts,ts2.ts)'.

  guido

  
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list