Dear all,

I posted this on Stack Overflow, but there is no response, so I try it here 
again.


I'm wondering about how to draw a highlighted rectangle with log y-axis in a 
trellis/lattice plot. My idea was to use panel.rect(), which works without a 
log scale:

library(lattice)

set.seed(1)

y <- runif(100, min=1, max=1000)
x <- seq_along(y)

xyplot(y ~ x,
       panel=function(x,y,...) {
           cpl <- current.panel.limits()
           panel.rect(xleft=cpl$xlim[1], ybottom=10,
                      xright=cpl$xlim[2], ytop=500,
                      fill="lightgray", border="lightgray", alpha=.6)
           panel.xyplot(x,y,...)

       },
       scales=list(y=list(log=FALSE))
       )


However, when log=TRUE, the rectangle disappears.


Are there any ideas? Thanks, Sven

<https://mail.med.uni-heidelberg.de/questions/tagged/,DanaInfo=stackoverflow.com,SSL+r>


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to