Skip to content

R to automate scatter plots

1 message · R. Michael Weylandt

#
I think you are off in the order of calls: you need to open the pdf
and then do all the plots so that they get pushed to the pdf. The
blank plot call won't do anything particularly helpful. If you use
pdf() after most of the plot commands they go to your default device
which is usually printing to the screen -- it's not tricky to copy a
plot from another device to a pdf, but you need to use dev.copy2pdf()
to do so.

Try this

pdf("test.pdf") # Open the pdf driver
plot(1:5) # Put one plot on the pdf
plot(1:6, col = 2) # put a seonc plot on the pdf
dev.off() # close the pdf

On my machine this produces a pdf with two plots.

For your script

pdf()

forloop

dev.off()



On Thu, Nov 10, 2011 at 2:38 PM, Cynthia Lee Page
<Cynthia.Page at colorado.edu> wrote: