A review of ggplot2 (0.8.9)


Very flexible, but slow

I have produced many complex graphics with both ggplot and lattice. One recent example required 3 seconds in lattice and 15 seconds in ggplot. In general, ggplot seems to be about 5 times slower than lattice. This may be due to the unified approach and abstractness of the "grammar of graphics". For example, the ggplot way of making a graph is something like:

Make a plot, of the "box" type, separately for each group.

Which takes longer to parse and process than the lattice way of:

Make a box plot for each group.

Somewhat surprisingly, the amount of code a person has to write in order to make a graph is almost the same for ggplot and lattice.

The default color palette in ggplot works well for polygons, giving equal "impact" to all colors, but in scatter plots the colors are too similar, making it difficult to distinguish more than five colors. Point colors in lattice offer more separability, although one of the default colors is light green, which is hard to see on white.

Both ggplot and lattice have extensive documentation and books.

The capabilities of lattice and ggplot are similar, so which one to use is mostly a matter of personal choice.