[R] large files produced from image plots?

baptiste Auguié baptiste.auguie at googlemail.com
Wed Sep 8 19:41:46 CEST 2010


Hi,

Have you tried the recent rasterImage() function?

HTH,

baptiste
	
On Sep 8, 2010, at 7:30 PM, Stephen T. wrote:

> 
> Hi list,
> I wonder if anyone has thoughts on making image plots in R [using image() or image.plot(), or filled.contour()]- I've made quite a bit now, but they seem quite large in size when exported to pdf file format (even after compressing with pdftk or ghostscript, which I regularly do). I know that for "images", raster graphics output (png, tiff) may be the way to go, but often the ones I make are multi-panel plots with other graphics on them, and are usually included in a LaTeX document (PDFLaTeX does accept png) and require stretching/shrinking (and/or possibly editing with Adobe Illustrator). I have had some luck exporting image plots from Matlab (to postscript or pdf) before in the sense that the files seem smaller and less pixelated. Is this a difference in the way image() plots are produced, or with the way the image is written to the pdf() device (if anyone is familiar with other image-exporting programs...)? The other day I had a 13MB dataset, and probably plotted 3/4 of it!
>  using image() and the compressed pdf output was about 8 MB (it contained other stuff but was an addition of a few KB). I tried filled.contour(), as I understand that it colors polygons to fill contours instead of coloring rectangles at each pixel - and it has saved me before - but this time the contours may have been too sharp as as its compressed pdf came out to be 62 MB... (ouch!). I have not tested this data set with other software programs so it may just have been a difficult data set. 
> Is there a good solution to this (or is it simply not to use a vector-graphics format in these instances), and just for my curiosity, are you aware of any things that other software (data analysis) programs do uder the hood to make their exported images smaller/smoother? 
> Thanks much!
> Stephen 		 	   		  
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list