Skip to content
Prev 218888 / 398498 Next

Determining whether "plot.new" has been called

On 04/29/2010 02:21 AM, Dennis Fisher wrote:
Hi Dennis,
I use:

if(dev.cur() == 1) # there is no graphics device open

which always seems to be the null device. Since I have never had 
occasion to switch to the null device, this is a sort of test for 
whether there is another graphics device open, and thus whether plot.new 
has been called (on the current device). While it has always worked for 
me, I am aware that it is a Sneaky Trick and may not work in some 
situations.

Jim