[R] Problem postscript(print.it)

Christian Hoffmann christian.hoffmann at wsl.ch
Tue Mar 20 14:41:15 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="") {
  if (view>0) f
  else {
    postscript(file=file,print.it=(view==0))
    on.exit(dev.off())
    f
  }
}

If I try with   view <- 0 or -1

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

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?

Thanks for help,

-christian


PS: Executing several statements of the type:

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

does not make any trouble.

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