[R] saving graphics in jpeg format

Paulo Barata pbarata at infolink.com.br
Wed Nov 22 01:29:26 CET 2006

Dear R users,

I need to save a graph in jpeg format. After plotting the graph,
when the graphics window is active, in the File menu, the
Save as / Jpeg / 100% quality correctly saves the graph in jpeg format.
But I would like to know, how could I control the resolution (in dpi)
of the saved jpeg file? I need to produce a jpeg at 1200 dpi.

I have tried also the jpeg function in the package grDevices.
A simple command like this works correctly:

jpeg(filename="test01.jpg", width = 800, height = 600, quality = 100,
    pointsize = 250)

But I can't figure out the relation between pointsize, pixels, points
and dpi. For example, to be specific, to save a graph measuring
width = 6 inches, height = 4 inches, at 1200 dpi, which parameters
should I use in the jpeg function?

I have consulted the R documentation and the R list archive, but
haven't found any proper (to me) information on this matter.

I am using R 2.4.0 running under Windows XP.

Thank you very much.


Paulo Barata

Paulo Barata
Fundacao Oswaldo Cruz (Oswaldo Cruz Foundation)
Rua Leopoldo Bulhoes 1480 - 8A
21041-210  Rio de Janeiro - RJ
E-mail: pbarata at infolink.com.br

More information about the R-help mailing list