I use RScript in Windows and by default it saves the plots into the pdf file Rplots.pdf, one plot per page.
I would like to get each plot saved into an image file like a .png, is it possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To save your plots as a
pngfile, the general idea is:similar functions are
jpegandtiff. Wrap all your plots in such calls topngto save the plots to specific names. Addingpng()at the top of the script will save all plots in different png files:Rplot001.png,Rplot002.png. I would however try and give meaningful names to the plots.Using Cairo devices, you can use
savePlot. When you plot withggplot2, the best way imo to save a plot is usingggsave.