[R] Positioning in xyplot

Michael Kubovy kubovy at virginia.edu
Thu Apr 12 14:08:00 CEST 2007


Wow! Thanks to Sundar and to Deepayan for this selfless effort.(I  
rather suspect they had a good time figuring this out.) The outcome  
is that I will be able to publish just the right figure for the job.  
I will be sure to aknowledge your contribtution.

Michael

On Apr 12, 2007, at 12:48 AM, Deepayan Sarkar wrote:

> 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