[R] Reccomendation for graphics package

Zeljko Vrba zvrba at ifi.uio.no
Fri May 1 19:55:59 CEST 2009


What would you recommend for producing publication-quality plots with R?
Built-in graphics, trellis, ggplot2, or something else?

Basic requirements:

- I need to draw line-, box-, density-plots, bar-charts and histograms
- error bars on bar- and box-plots
- easy tiling of multiple plots on a single "page"

Basic R plotting with mfrow and mfcol parameters is not satisfactory because a
lot of space is lost on duplicated labels in margins. (In fact, I have not been
able to figure out how to generate a plot that looks nicely when included in a
latex document.. short of generating it on a 4x larger area, and including it
scaled down by 50%.. but that's a separate issue)

Lattice demos look impressive, but it seems that one must write a lot of custom
functions to get what one wants -- so the learning curve is rather steep
whenever one wants anything not provided out-of-the box (e.g. multiple line
plots in a single figure, each with its own error bars).

Is situation anything better with ggplot2?  It seems rather easy to get e.g.
line plots with error bars, provided that one feeds the data to some
modeling/regression function and passes the result over for plotting.. but what
if I have generated my own error bar data?  This is almost trivial to
accomplish with built-in plot functions (lines function), but that doesn't play
nicely with composing plots..

Is there something that provides the simplicity and straightforwardness[1] of
built-in plot functions, along with the power of lattice arrangement of plots?
Experience stories are also welcome.

[1] plot() takes simple vectors of x,y coordinates.  I had to reverse-engineer
lattice examples to figure out in what format I should present my data to it.
Astounding that such elementary thing is not better explained.

More information about the R-help mailing list