[R] png and pdf : point size, font size, etc.

Michael wuolong at gmail.com
Wed Feb 27 16:48:57 CET 2008


On 27 Feb 2008, Stephan Ripke wrote:

> The problem is, that the font size and the point-size of the plotpoints
> and the all of the plot is getting much smaller when using png-format. Why
> is this and how can I circumvent this issue?  These are the two devices, I
> am opening for the two reasons:
> 
> 1)
> pdf("name_out.pdf",11,3.5)
> 2)
> bitmap("name_out.png",height=3.5,width=11)

Why not the 'png' device? 

You can try different picture size and font sizes.  For png, the size of the
figure is in pixels (rather than inches for pdf), and the fonts are in
'points'.  The documentation of png says that one point is approximately one
pixel.

However, that is assuming 72 dpi (screen resolution).  For printing (e.g.,
inserting into Word), you would want at least 600dpi, or even 1200dpi, so
you need set a font size proportional to the total image size.

I usually just make a pdf file and then convert it to png with 'convert'
from ImageMagick to the desired resolution:

convert -density 600x600 a.pdf a.png

Michael



More information about the R-help mailing list