[R] Positioning in xyplot

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Apr 12 00:48:03 CEST 2007


On 4/11/07, Sundar Dorai-Raj <sundar.dorai-raj at pdf.com> wrote:
>
> Hi, Deepayan,
>
> See the attached image for what your code produced. Not sure if this is
> what you intended.

Here's the correct version of callAfterMoving (I thought I had fixed
it, but I guess I pasted the wrong thing):

## this calls 'fun' after moving its viewport if panel.number() == 5

callAfterMoving <-
   function(fun, border = TRUE, move.x = 1, ...)
{
   if (panel.number() != 5) {  ## was == 5
       fun(...)
       if (border) grid.rect()
   }
   else {
       cpl <- current.limits()
       pushViewport(viewport(x = move.x,
                             width = unit(1, "npc"),
                             xscale = cpl$xlim,
                             yscale = cpl$ylim,
                             clip = "off"))
       fun(...)
       if (border) grid.rect()
       upViewport()
   }
}

-Deepayan



More information about the R-help mailing list