[R] dev.copy()

David Brahm brahm at alum.mit.edu
Mon Jun 30 21:59:55 CEST 2003


In a batch script (i.e. there is no screen device), I would like to create both
a PDF file and a PNG file from the same plot.  I thought this would be the way
to do it, but it isn't:

 R> bitmap("copy.png", "png16m", res=300)
 R> pdf("copy.pdf")
 R> plot(1:10, 1:10)     # Plot into pdf file
 R> dev.copy(which=2)    # Copy to png file
 R> dev.off(3)           # Close pdf
 R> dev.off(2)           # Close png

The PDF comes out fine, but the PNG appears blank.  Any ideas what I'm doing
wrong?  TIA.
-- 
                              -- David Brahm (brahm at alum.mit.edu)




More information about the R-help mailing list