On Thu, Jun 10, 2010 at 9:30 PM,  <rchand...@nrc.umass.edu> wrote:
> Hello list,
>
> Is there a way to add contour lines to a levelplot at different breakpoints
> than are used for the colors? For example:
>
>
> library(lattice)
>
> # colors good but too many contours
> levelplot(volcano, at=94:195, contour=TRUE)
>
> # I thought something like this might work
> levelplot(volcano,
>    panel=function(...) {
>        panel.levelplot(..., at=94:195)
>        panel.contourplot(..., at=c(100, 125, 150))
>        })

Something like that does work, you just need to capture and modify the
relevant arguments:

levelplot(volcano,
   panel=function(..., at, contour, region) {
       panel.levelplot(..., at=94:195, contour = FALSE, region = TRUE)
       panel.contourplot(..., at=c(100, 125, 150), contour = TRUE,
region = FALSE)
       })

Unless you capture the arguments explicitly, they get supplied to
panel.contourplot etc. twice, once when you explicitly specify it, and
once as part of the ...-s.

-Deepayan

______________________________________________
R-help@r-project.org 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.

Reply via email to