[R-SIG-Finance] How to use zooreg and zoo in same plot?
Matthieu Stigler
matthieu.stigler at gmail.com
Mon Apr 19 14:49:46 CEST 2010
Hi
I'm having problems showing two time series in a plot, when one is of
class zoo and the other one zooreg. I searched but did not find mention
of this problem... do I do something wrong? How can I solve this? Thanks
a lot!!
x.date <- as.Date(paste(2004, rep(1:12, each=8),
rep(c(1,4,8,12,16,20,25,28),6), sep = "-"))
x <- zoo(rnorm(96), x.date)
z<-zooreg(runif(12), start=c(2004,1), freq=12)
y<-zooreg(runif(4), start=c(2004,1), freq=4)
#try different plot methods:
plot(cbind(x,z)) #does not work
plot(cbind(y,z)) #show only z, probably because of point 9 in zoo-FAQ?
plot(cbind(y,z), type="p") #then works!
plot(x)
lines(z,col=2) #z not ploted
points(z,col=2) #z not ploted
plot(z)
lines(y,col=2) #work!
More information about the R-SIG-Finance
mailing list