[R] Determining whether "plot.new" has been called

Dennis Fisher fisher at plessthan.com
Wed Apr 28 18:21:18 CEST 2010


I have a lengthy script that calls mtext.  Under most circumstances, a graphics device is open and a plot exists, in which case mtext works as expected.  However, there are some instances where the graphics device is open but no plot exists.  When mtext is called, I receive an error message:
	Error in mtext(1) : plot.new has not been called yet 

The solution is to confirm that:
	a.  the device is open:		length(dev.list()) > 0
	b.  whether plot.new has been called.

I need help on the latter - how does one test whether plot.new has been called?

Thanks in advance.


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)

More information about the R-help mailing list