[R] quartz() and dpi
JiHO
jo.lists at gmail.com
Thu Jan 28 02:23:04 CET 2010
Hello all,
I am using quartz (on OS X obviously) to produce PDFs and PNGs from my
plots, for later inclusion in LaTeX.
I am typically using something like:
plot(0)
dev.print(quartz, file="foo.pdf", width=5, height=3)
dev.print(quartz, file="foo.png", width=5, height=3, dpi=72)
I want the sizes of the PDF and PNG to be *equal* in *inches*, which
works with dpi=72. However, when I increase the dpi parameter, instead
of producing an image of the same size with increased resolution, it
creates a larger image of resolution = 72. E.g. try
dev.print(quartz, file="foo-72.png", width=5, height=3, dpi=72)
dev.print(quartz, file="foo-300.png", width=5, height=3, dpi=300)
system("open -a Preview.app foo-*.png")
The inspector in Preview should show 72 dpi for both files. This is with:
> sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-apple-darwin9.8.0
Is this a know bug/limitation? Is a solution planned? Is there a
workaround for now?
As a final note, I am aware that PDF is superior to PNG, particularly
in a LaTeX workflow; but for particularly complex plots, I sometimes
fall back on high resolution PNGs. Currently it forces me to add a
'scale' argument to includegraphics in latex for those. I would rather
leave the latex document alone, use extension-less file names
includegraphics and decide from R wether to produce a pdf or a png.
Thank you in advance,
JiHO
---
http://maururu.net
More information about the R-help
mailing list