Remko Duursma <remkoduursma <at> gmail.com> writes: > >> 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". > > Deepayan: > > 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 > > > > ?setHook > > ?plot.new > > ?grid.newpage > >
Dieter: library(lattice) isStandard = function() { options(graphics="standard") } isLattice = function() { options(graphics="lattice") } setHook("plot.new",isStandard) setHook("grid.newpage",isLattice) xyplot(1~1) options("graphics") plot(1,1) options("graphics") ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.