Reputation: 103
I have a list in R which includes plots as elements. Instead of viewing each element and saving it one by one, how can I export these plots and save them onto my desktop or into the R folder?
Upvotes: 1
Views: 1421
Reputation: 4233
You need to initiate a device (e.g., pdf
), loop over your plot list, and then close the device.
pdf('path/to/pdf')
pdf.options(width = 9, height = 7)
for (i in 1:length(plot_list)){
print(plot_list[[i]])
}
dev.off()
This will create a pdf file that contains all the plots.
Upvotes: 3