[R] levelplot add line

Deepayan Sarkar deepayan at stat.wisc.edu
Fri Feb 27 02:00:44 CET 2004


On Wednesday 25 February 2004 14:00, Jeff Jorgensen wrote:
> Thanks for putting me on the right track.  Sorry to be bothersome with
> another follow-up, but the code that calls the panel function (see
> below) doesn't seem to be working.  What am I doing wrong?

You are using this wrong. In particular I'm completely confused by the 
c(...) usage.

You probably want something like

          panel = function(...) {
              panel.levelplot(...)
              panel.abline(h = 200)
          }

since you are not using any of the arguments passed to the panel function 
for the panel.abline call. If you do need to use something, say x, y, and 
z, your usege should be:


          panel = function(x, y, z, ...) {
              panel.levelplot(x = x, y = y, z = z, ...)

              ## do something with x,y,z
              hloc = foo(x, y, z)
              panel.abline(h = hloc)
          })


Deepayan



> Thanks,
>
> Jeff
>
> levelplot(matrix,contour=T, cuts=15,at=seq(...), labels=T, region=T,
>                             
> scales=list(x=list(at=xlocations,labels=as.character(xlabels)),
> y=list(at=ylocations,
> labels=as.character(ylabels))),
>                              xlim=c(1:368), ylim=c(1:31),
>                              colorkey = list(space = "bottom",
>                                              labels = list(at =
> seq(0,2000,200),
>                                              lab = seq(0,2000,200))),
> #If I cut it off here, it works fine
>          panel=function(x,y,z){
>                              panel.levelplot(x=c(...), y=c(...),
> z=matrix, cuts=15,at=seq(...), contour=T, labels=T, region=T,
>                              subscripts=seq(...),
>                              col.regions=cm.colors(100),
>                              zcol=c(1:100),
>                              panel.abline(h=200))
>              })




More information about the R-help mailing list