Try this (or use xyplot.zoo and write a panel function for that): library(zoo) set.seed(1) tt <- as.Date(paste(2004, rep(1:2, 5), sample(28, 10), sep = "-")) foo <- zoo(matrix(rnorm(100), 10), tt)
pnl <- function(x, y, ...) { lines(x, y, ...) abline(h = mean(y)) } plot(foo, panel = pnl) On 3/16/07, Jonathan Wang <[EMAIL PROTECTED]> wrote: > Suppose I create a multiple plot with zoo, using: > > index <- ISOdatetime(2004, rep(1:2, 5), sample(28, 10), 0, 0, 0) > foo <- zoo(rnorm(10), index) > for (i in 1:9) { > data <- rnorm(10) > z1 <- zoo(data, index) > foo <- cbind(foo, z1) > } > plot(foo) > > This creates 10 plots on one device, one for each column in foo. > > Now I want to go back and use abline to draw a line at the mean on each of > my 10 plots. How do I select the appropriate set of axes to draw my line on? > > Thanks, > Jonathan > > [[alternative HTML version deleted]] > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.