[R] Size of plots in pdf files#can it be smaller?

Philipp Pagel p.pagel at wzw.tum.de
Mon Sep 7 22:50:50 CEST 2009


> I have to produce arrangements of 25 simple plots of the type
> plot(x,y,pch=".") where there are typically on the order of 20000
> points.
> So, overall, I have about 500000 points. When I use the pdf device,
> I get file sizes (on a Windows machine) of about 10 MB.
> When I then zip the files, I'm down to about 0.5MB, so the original
> pdf files were created with a lot of 'air'.
> I'm wondering why the pdf files are so large and whether there is an
> alternative to produce them smaller. Any ideas?

As far as I know, R cannot directly produce compressed pdf files. You
could postprocess your plots. E.g. pdftk is quite conveniant:

pdftk foo.pdf cat output foo2.pdf compress

Maybe in a loop if many files are involved.

cu
	Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/




More information about the R-help mailing list