[R] which one give clear picture-pdf, jpg or tiff?

Joshua Wiley jwiley.psych at gmail.com
Fri Aug 20 17:57:38 CEST 2010


On Fri, Aug 20, 2010 at 7:30 AM, Stuart Luppescu <slu at ccsr.uchicago.edu> wrote:
> On Fri, 2010-08-20 at 01:30 -0700, Joshua Wiley wrote:
>> I usually save them
>> from R as a PDF or postscript file, rasterize them in GIMP (free
>> answer to Photoshop) at the desired resolution, and finally choose the
>> desired format/compression (jpeg, png, bitmap, tiff, etc.) to save it
>> as from there.
>
> Woah. That's really involved. I use this little shell function to
> convert from ps to png:

You're right, it is, and I do not think I need to.  I used to think
that png() was limited in how high a resolution it could output, but I
was interpreting messages like this:

> png(file = "plot24000x24000.png", width = 24000, height = 24000, res = 3600)
Error in png(file = "plot24000x24000.png", width = 24000, height = 24000,  :
  unable to start device
In addition: Warning messages:
1: In png(file = "plot24000x24000.png", width = 24000, height = 24000,  :
  Unable to allocate bitmap
2: In png(file = "plot24000x24000.png", width = 24000, height = 24000,  :
  opening device failed

as a limit/problem with the settings I passed to png(), and now I
think it was just a memory issue.  I used to get messages like that
even down around 4800 x 4800, but on my current rig I was able to get
this to work

png(file = "plot23000x23000.png", width = 23000, height = 23000, res = 2400)
print(myplot)
dev.off()

it takes a few minutes and my overall system memory usage jumps up ~
3GB, but it is a lot less effort than switching programs and I am left
with a very pretty graph that I can blow up to my heart's content :)

--Josh



More information about the R-help mailing list