[R] 300 dpi and eps:

Philipp Pagel p.pagel at wzw.tum.de
Thu Dec 16 19:31:06 CET 2010

> Can someone recommend some paper that makes clear the relation and
> distinctions between vector and raster graphics, but especially with
> some practical examples in regard to what is the relation between
> page (height and width) and dpi.

I'm not aware of a paper, but it's really not rocket science, as long
as you stay away from color calibration at which point it IS rocket
science ;-)

You should not be concerned at all with the relation between page
dimensions and dpi - that's the publishers business. All you need to
ensure is that the figures you provide are of high quality and in an
accepted format.

> In A. photoshop for example I can define for a graph width in
> inches, height in inches and resolution in pixels/inch color model
> CMYK and 8 bit. How one works in R?

Don't. Just stick with a vector format. All journals I have ever dealt
with accepted either EPS or PDF as a vector format.

> Or one saves the graph from postscript function as eps or tiff and
> you tell to the editor of the journal do whatever you want because I
> am done; I provided you already a vector graph that has infinite
> pixels?:-)

Exacxplty that, except TIFF is not a vector format and you should not
use it with R.

Some rules of thumb:

Use a pixel format if and only if

 1) your image is a picture from a digital camera, scanner,
 	microscope, screenshot or similar. I.e. the original graphics wants
 	to be a pixel graphics by nature.

 2) You are forced to by higher powers. In this case stick with vector
	format until your figure is 100% ready and only then convert to a
	high-resolution TIFF/PNG/whatever.

Use a vector format in all other cases - especially if we are talking
about things you create in the computer yourself: R graphs,
flow-charts, technical illustrations, ...

If you want to add annotation to an image (i.e. a pixel graphis) never
use Photohop or similar software - instead import the pixel graphis
into a vector graphis software (e.g. Illustrator/Corel Draw/...) and
add your arrows, text etc. While this will not magically make the
image a better or even infinite resolution, it will make sure the rest

If you have images (scans, photos, ...), avoid lossy compression
formats (e.g. jpg), use TIFF (or maybe PNG) instead. Lossy compression

 a) ruin edges - e.g. lines of a graph (that's whu screenshots in jpg
    always look crappy)

 b) degrade in quality with every "decompress - edit - compress" cycle

The only occasion I ever convert my vector graphics to a pixel format
is when a colleague who has to use PowerPoint needs it for a
presentation. As PowerPoint does not support any vector formats except
that flaky wms/ems format there is no other choice. So I convert to a
e.g. 600dpi png. (Has this changed in recent versions of PowerPoint?)
But mind you: I don't do that in R, so I always have a vector format
master figure.


Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany

More information about the R-help mailing list