[R] Pdf file size for very scatter plots

Jim Holtman jholtman at gmail.com
Sat Aug 16 06:58:51 CEST 2008


The best way is to try it and see if you like it. I have used it on  
plots with 150,000 point and it provided a good picture of what was  
going on.

Sent from my iPhone

On Aug 15, 2008, at 13:52, Stephen Tucker <brown_emu at yahoo.com> wrote:

> I thought running it through latex will compress the pdf - but this  
> post nicely summarizes some options:
>
> http://tolstoy.newcastle.edu.au/R/e2/help/07/05/17475.html
>
> I personally prefer the pdftk approach* over the ghostscript  
> option**  as the latter seems to give me a number of problems on  
> Windows XP.
>
> *if you install pdftk (and put it in your search path), after you  
> create filename.pdf with pdf(), do
> pdftk filename.pdf cat output newfilename.pdf compress
> or
> pdftk filename.pdf cat output newfilename.pdf compress dont_ask
>
> **if you have ghostview installed (and in your search path),
> bitmap("filename.pdf",type="pdfwrite")
> plot(...)
> dev.off()
>
>
>
>
>
> ----- Original Message ----
> From: Nazareno Andrade <nazareno at lsd.ufcg.edu.br>
> To: r-help <r-help at r-project.org>
> Sent: Friday, August 15, 2008 12:46:52 PM
> Subject: Re: [R] Pdf file size for very scatter plots
>
> Jim,
>
> Thanks for the answer. Using pch="." reduces the file to ~3MB...  
> Still large.
>
> I'll look into hexbins, but if I understand it right, it would 'round'
> points which are nearby into a same hexagon, right? Couldn't that
> result in an inaccurate view of a scatter plot?
>
> Here's the code I'm using:
>
> pdf(); plot(rnorm(1e5), rnorm(1e5), pch = "."); dev.off()
>
> thanks again,
> Nazareno
>
> On Fri, Aug 15, 2008 at 12:27 PM, jim holtman <jholtman at gmail.com>  
> wrote:
>> Have you tried using  pch='.'?
>>
>> Also you might consider using 'hexbin' for creating the scatter plot.
>>
>> On Fri, Aug 15, 2008 at 12:24 PM, Nazareno Andrade
>> <nazareno at lsd.ufcg.edu.br> wrote:
>>> Dear all,
>>>
>>> I am plotting a scatter plot for a large sample (1e+05 ordered  
>>> pairs).
>>> This produces a large (~5MB) file in a pdf or postscript terminal,  
>>> and
>>> I am wondering whether there are methods for reducing the size of  
>>> the
>>> resulting file so that it is easier to include it in a document. I'd
>>> rather stick with pdf or ps as I am using latex.
>>>
>>> thanks,
>>> Nazareno
>>>
>>> ______________________________________________
>>> 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?
>>
>
> ______________________________________________
> 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.
>
> ______________________________________________
> 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