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

jim holtman jholtman at gmail.com
Tue Sep 8 02:00:24 CEST 2009


The reason for the size of the file is that when generating a PDF,
commands are generated to plot "each" point.  I generated a PDF file
with 10,000 and there were 10,000 of lines similar to the following:

159.93 349.01 1.00 1.00 re f
343.19 283.07 1.00 1.00 re f
427.86 323.58 1.00 1.00 re f
431.68 230.08 1.00 1.00 re f
93.79 278.89 1.00 1.00 re f
425.78 332.10 1.00 1.00 re f
332.04 366.16 1.00 1.00 re f
78.55 305.61 1.00 1.00 re f
277.22 135.42 1.00 1.00 re f
423.47 101.07 1.00 1.00 re f
435.86 289.67 1.00 1.00 re f

My question is why do you need so many points?  Have you looked at
'hexbin' as way of plotting the data?  Have you considered generating
'jpg' output which will be much smaller; e.g. a jpg file with 10,000
points was 70K and one with 100,000 was 90K -- it only created the
pixels to be plotted.

On Mon, Sep 7, 2009 at 7:43 AM, Christian
Ritter<christian.ritter at uclouvain.be> wrote:
> Hi all,
>
> 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?
>
> Have a nice afternoon,
>
> Chris.
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list