Skip to content
Prev 391111 / 398506 Next

panel.rect and log scale in lattice plot

thanks, this do the trick!

xyplot(y ~ x,
       panel=function(x,y, ...) {
           cpl <- current.panel.limits()
           yseq <- log(c(100,1000))
           panel.rect(xleft=cpl$xlim[1],
                      ybottom=yseq[1],
                      xright=cpl$xlim[2],
                      ytop=yseq[2],
                      fill="lightgray", border="lightgray", alpha=.6)
           panel.xyplot(x,y,...)
       },
       scales=list(y=list(log=2))
       ) 

Best Regards, Sven