shading under the lines in a lattice xyplot?
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")
})