Why not just plot all your graphs directly to a file rather than sending them to a windows device that you are not looking at, then copying from there. The pdf and postscript devices will hold several plots in a single file, or the png device (and others) will automatically create 1 file per graph and you can either set the name for each, or use a set of sequential names. This should be easier, more straight forward, and more portable.
Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Kinoko > Sent: Tuesday, November 25, 2008 3:12 AM > To: r-help@r-project.org > Subject: [R] how to plot and save plots in batch mode > > Dear list, > > This is not a question but a rather short note how to save a plot > if it was created in batch mode. > It took me like 2 hours to figure it out, I hope it can save time > for those who - like me - are not really fast in picking up > diosyncrasies of R. (as far as I remember I had no problems whatsoever > batch plotting in > gnuplot, matplotlib, matlab... ) > > The problem I had was that while I could plot and save my data using > RGui, > the same script did not work in batch mode. > > plot(x,y, bla-bla... ) > ... > dev.set (2) > dev.print (device=png, file=outFile, bla-bla) > > But this does not work in BATCH mode. > The error msg is: > "... can only print from a screen device" > Sure, the plotting window does not pop up in batch mode. > > What I had to do was to to put a command: > > windows() > > before starting the plot. Now I can save my plots in batch mode > > Well, I am more than sure, that there are more elegant solutions > without invoking the window... > > ______________________________________________ > 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. ______________________________________________ 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.