[R] Saving a graph

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 30 08:27:23 CEST 2011


On Mon, 29 Aug 2011, Dieter Menne wrote:

>
> Gang Chen-4 wrote:
>>
>> However, my problem is that the file generated
>> from a graph of fixed size is too large (in the order of 10MB) because of
>> many data points in multiple scatterplots. Any suggestions?
>>
>
> Generate pdf, open and save it in Adobe Acrobat which does a compression
> when the setting are correct.

*If* compression is enough, pdf() in R-devel does it, as does 
cairo_pdf() in current R.  And there are other ways than Acrobat to 
compress/compact a PDF file: see ?tools::compactPDF  and the 'Writing 
R Extensions' manual.

However, compression will not make that much of a difference (maybe a 
factor of 3), and the real problem seems to be the inappropriate plot. 
If you really need a plot with hundreds of thousands of points (or 
more), use a format like PNG -- but there are better ways to display 
such plots for most statistical purposes.  E.g. image and contour 
plots of densities, hexplots, density-dependent thinning ....

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list