[R] Help with postscript (huge file size)

Ben Bolker bolker at ufl.edu
Sat Apr 11 21:16:21 CEST 2009


  Do you mean you're importing jpegs or other bitmaps into
R and writing them out (possibly with annotation etc.) as
PostScript?
  Can you give a small example of some sort?  It would
help for giving advice.




Talita Perciano wrote:
> Thank you for the answer. Just to clear things out, I'm generating plots of rgb images.
> 
> Talita
> 
> 2009/4/11 Ben Bolker <bolker at ufl.edu<mailto:bolker at ufl.edu>>
> 
> 
> Talita Perciano wrote:
>> Dear users,
>>
>> I'm generating some images in R to put into a document that I'm producing
>> using Latex. This document in Latex is following a predefined model, which
>> does not accept compilation with pdflatex, so I have to compile with latex
>> -> dvi -> pdf. Because of that, I have to generate the images in R with
>> postscript (I want a vector format to keep the quality). The problem is
>> that
>> the files of the images are very huge (10MB) and I have many images to put
>> into the pdf document.
>> I want to know if there is a way to reduce the size of those images
>> generated by R using postscript.
>>
>> Thank you in advance,
>>
>> Talita
>>
>>
> 
>  Not in any extremely easy way.  The fundamental problem is
> that if you have a whole lot of points in your graph, it's hard
> to make them take less file space even if they're overplotted
> (and hence not visible in the actual image).
>  This has been discussed in various forms on the R list in the past,
> but I can't locate those posts easily.  It's a little hard without knowing
> what kind of plot you're generating, but I'm assuming that you have
> many, many points or lines in the graphic (or a very high-resolution
> image plot), and that the details don't all show up in the figure anyway.
> A few general strategies:
> 
>  * thin the points down to a random subset
>  * use a 2D density plot or hexagonal binning
>  * create a  bitmap (PNG) plot, then use image
> manipulation tools (ImageMagick etc.) to convert that back to
> a PostScript file
>  * there was some discussion earlier about whether one
> could embed a bitmap of just the internals of the plot, leaving
> the axes, labels etc. in vector format, but I don't think that
> came to anything
> 
>  good luck
>   Ben Bolker
> 
> --
> View this message in context: http://www.nabble.com/Help-with-postscript-%28huge-file-size%29-tp23003428p23004309.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org<mailto: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.
> 
> 
> 
> --
> Talita Perciano
> Instituto de Matemática e Estatísitca
> Universidade de São Paulo - USP
> PhD Student in Computer Science
> São Paulo, SP, Brazil
> Tel: +55 11 8826 7092
> 
> "Success is not final, failure is not fatal: it is the courage to continue that counts."
> (Winston Churchill)
> 


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bolker at ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090411/02d62851/attachment-0002.bin>


More information about the R-help mailing list