[R] Save multiple plots as pdf or jpeg

David Winsemius dwinsemius at comcast.net
Tue Apr 15 19:35:12 CEST 2014


On Apr 15, 2014, at 2:09 AM, Pavneet Arora wrote:

> As a result, the pdf takes forever to load and doesn?t let me print, as it 
> runs out of memory. I was wondering if there is a way if I can save each 
> plot as jpeg and then export it on pdf. Will that make it quicker in 
> loading? If so, how can I do this? And if not, then what are the 
> alternatives.

Here's the problem

>  1355615 obs. of ....

... followed  by:

 qqnorm(nums2[,k],col="lightblue",main=names(nums2)[k]) 
....

PDF files may take multiple text characters to include one point.

And the further problem is linked to your chosen format.

> 
> Also when saving as jpeg in R, I realise there is a wildcard in filenames, 
> i.e.. 6 plots can be saved as:
> jpeg(filename="foo%03d.jpeg",. . . )
> dev.off()
'
 As far as I know, jpeg does not have a multi-page option. You can deliver jpegs embedded in other formats like .doc or pdf but those would be mediated by programs designed to do that.

The tiff format is bitmapped and has multi-page options.

-- 

David Winsemius
Alameda, CA, USA




More information about the R-help mailing list