[R] How to tell if lattice is current device?
deepayan.sarkar at gmail.com
Thu Feb 12 01:11:50 CET 2009
On Wed, Feb 11, 2009 at 3:40 PM, Remko Duursma <remkoduursma at gmail.com> wrote:
> Dear R-helpers,
> I have a function that adds some segments to the current plot, but if
> I the current plot is made with any of the lattice functions (in my
> case, levelplot),
> I should use lsegments rather than segments.
> How can I tell if the current device was made with plot() or e.g.
> levelplot() or another lattice function?
> dev.cur() does not help me, it just tells me "windows 2".
A device can have both types, although that's rare.
The best you can probably do is keep track of the last call to
plot.new() and grid.newpage(). See
More information about the R-help