Re: [R] Multiple series plot with different 'type' argument

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon 25 Jul 2005 - 03:18:12 EST

plot.zoo can do that.

library(zoo)
set.seed(1)
xts <- ts(rnorm(20)); xz <- as.zoo(xts)
yts <- ts(rnorm(20)); yz <- as.zoo(yts)
plot(cbind(xz,yz), type = c("p","l"), plot.type = "single")

On 7/24/05, Ruben Roa <RRoa@fisheries.gov.fk> wrote:
> Hi:
> I need to plot two time series in the same plot and
> they cover the same time range and have the same
> frequency. With
> RSiteSearch("multiple series plot")
> i found this post by Gabor Grothendieck:
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/42281.html
> Exactly what i need except for one detail. I want one series
> to be made of points and the other by a line. When I simply
> try:
> xts <- ts(x$b,start=x$a[1])
> yts <- ts(y$b,start=y$a[1])
> ts.plot(xts,yts,type=c("p","l"))
> or if i use the 'type' argument inside gpars=list()
> i get an error of "invalid plot type".
> Then if i try
> ts.plot(xts,yts,type1="p",type2="l")
> i get warnings about NAs introduced by coercion and the
> plot still shows two lines.
> Is there any other way i can get these two time series
> in the same plot one with points and the other with lines?
> Any help much appreciated.
> Ruben
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 25 03:23:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:59 EST