[R] Call to trellis.focus(); thenpanel.superpose()

Paul Murrell p.murrell at auckland.ac.nz
Mon Nov 29 20:02:08 CET 2004


Hi


Deepayan Sarkar wrote:
> On Monday 29 November 2004 04:46, John Maindonald wrote:
> 
>>The following works fine with the x11 device, though it
>>may well be that an initial plot is overwritten.  With a pdf
>>or postscript device, I get two plots, the first of which
>>still has the red border from having the focus, while the
>>second is the plot that I want.
>>
>>         library(lattice); library(grid)
>>         plt <- xyplot(uptake ~ conc, groups=Plant, data=CO2)
>>         print(plt)
>>         trellis.focus("panel", row=1, column=1)
>>         arglist=trellis.panelArgs()
>>         arglist$type <- "l"
>>         do.call("panel.superpose", args=arglist)
>>         trellis.unfocus()
>>
>>Should I be able to use panel.superpose() in this way?
> 
> 
> Yes. The red border should be 'removed', but that's done by grid.remove 
> and maybe it doesn't work on PDF devices.


It works, but it works by removing the red rectangle from the list of 
objects representing the scene and then redrawing the scene, hence a new 
page.

Paul


> The solution is to use 
> 
> trellis.focus("panel", row=1, column=1, highlight = FALSE)
> 
> (which happens automatically for non-interactive sessions).
> 
> 
>>The new abilities provided by trellis.focus() etc add
>>greatly to the flexibility of what can be done with lattice
>>plots.  The grid-lattice combination is a great piece of
>>software.
> 
> 
> Yes, it can be especially useful for tasks similar to identify(). 
> Everything else can probably be done by clever enough use of the panel 
> function (though perhaps not as naturally).
> 
> Deepayan
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/




More information about the R-help mailing list