[R] plot.new has not been called yet

Christian Hoffmann christian.hoffmann at wsl.ch
Mon Mar 19 16:14:51 CET 2001


Hi all,

I have a problem with plotting: (R-1.2.2 on 
SunOS fluke 5.5.1 Generic_103640-27 sun4u sparc SUNW,Ultra-Enterprise
solaris 2.)

I define a function to switch between plotting on graphics device and
generating a postscript file (which can also be automatically be printed) 

plt <- function(view,f,file="") { ## C.Hoffmann,  2001.03.14
  if (view>0) f
  else {
    postscript(file=file,print.it=(view==0))
    on.exit(dev.off())
    f
  }
}

Executing several statements of the type:

plt(1,plot(rnorm(100),rnorm(100),"test")

does not seem to make any trouble.
If I try 

plt(0,plot(rnorm(100),rnorm(100),"test")

more than once, I am getting the error

plot.new has not been called yet

and subsequent executions of
plot.new()

are having no positive result.   ??????
What am I missing?



How can I open an X "R Graphics Device" if I have unintentionally closed
it, without q() and restarting of R?



Thanks for help,

-christian
Dr.sc.math.Christian W. Hoffmann
Mathematics and Statistical Computing
Landscape Modeling and Web Applications
Swiss Federal Research Institute WSL 
Zuercherstrasse 111
CH-8903 Birmensdorf, Switzerland
phone: ++41-1-739 22 77    fax: ++41-1-739 22 15
e-mail: Hoffmann at WSL.CH
www: http://www.wsl.ch/staff/christian.hoffmann/

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list