[R] Saving plot into file
ymoisan at groupesm.com
Fri Aug 31 15:33:27 CEST 2007
> Hello. I am using R with Mac X11. I am looping through a few hundreds of
> text lines, making a plot() for each of them. I would like to save these
> plots graphical images into separate graphical files and I didn't succeed
> doing that. I would be grateful for any suggestion.
Use jpeg or similar functions that redirect graphical output to file, e.g.
jpeg(filename = "plot.jpg", width = 800, height = 800,pointsize = 12,
quality = 100, bg = "white")
As mentioned in ?jpeg : "A plot device is opened: nothing is returned to the
R interpreter" so you'll see nothing happening except your next graphics
command will be written to the file.
dev.off() restores the normal R-graphics device. I usually set the working
directory before redirecting the ouput to a file e.g.
setwd("C:/dir/subdir"). That's useful when you have many plots to generate
and want them stored in different places on your filesystem.
View this message in context: http://www.nabble.com/Saving-plot-into-file-tf4359947.html#a12426520
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help