2.8 Saving plots
If you want to save your plots to an image file there are couple of ways of doing that. Normally, you will have to do the following: 1. Open a graphics device 2. Create the plot 3. Close the graphics device
pdf("mygraphs/myplot.pdf",width=5,height=5) plot(x,y) dev.off()
Alternatively, you can first create the plot then copy the plot to a graphic device.
plot(x,y) dev.copy(pdf,"mygraphs/myplot.pdf",width=7,height=5) dev.off()