[R] shading under the lines in a lattice xyplot?
Andy Bunn
abunn at whrc.org
Wed Feb 15 18:28:17 CET 2006
In the lattice plot below I want to fill-in the areas under each lines that
are greater than zero in gray. Is there a straightforward way to go about
this? Thanks, Andy
library(lattice)
foo <- data.frame(Yrs=rep(1:50,4), Y=rnorm(200),
Id=unlist(lapply(letters[1:4],rep,50)))
xyplot(Y~Yrs|Id, data = foo,
panel = function(x,y) {
panel.abline(h=0)
panel.lines(x,y, col = "black")
})
More information about the R-help
mailing list