I'm currently writing the back cover for the ggplot2 book, and I'm
stuck on what specific features of ggplot2 I should mention. If you
wouldn't mind, could you please send me a couple of bullet points
describing the things that you have found easy in ggplot2 compared to
other packages. (You can also send me things that are hard in ggplot2
and easy in other packages, to add to my to do ;)
Thanks!
Hadley
Thanks for all the great suggestions! They are so nice, that I think
I'll try and present them on the website in some way, as well as
distilling them into a few sentences for the back of the book. In
case you're interested, I've included all the things that people
particularly like in ggplot2 below (in no particular order).
Thanks!
Hadley
Automatic legends, colors, etc.
The "default" output is much nicer than with base graphics, unless
starting from the output of a statistical analysis, where people have
written nice things in base.
Easy two-colour gradients to distinguish positive and negative values
in GAM surfaces.
Easy access to ribbons with transparency, for confidence intervals.
Combine multiple data sets into a single graph with a snap-together,
building-block approach.
Large variety of customizable smoothing overlays, including loess,
[list the other R packages whose smoothing you support, and emphasize
the 2D (kde?)].
Handsome default settings.
Approach your graph from a visual perspective rather than a
programming perspective.
Turn a rectangular (?) graph into a polar graph with a single statement.
Store any ggplot2 object for modification or future recall.
easy superposition (boxplot + points + lines + ...) +++
easy facetting ++
easy legend ++
object oriented graph (I'm not sure for this...)
beautiful default parameters
theme support
Facile facetting
Luscious layering
easy to make pretty and elaborate graphs
carefully chosen default colour schemes and layout so the user
needn't worry about aesthetic values that he wouldn't necessarily know
himself well enough
consistent look across graphics
literate programming: you describe the plot almost in a natural
language. It makes it much easier to reuse code and come back to a
graph in a few years time without feeling lost.
only few high-end functions, but with very wide applicability
based on grid, the preferred and recommended way to develop new graphics in R
powerful layer system that makes it easy to combine different sources of data
superpose several layers (possibly from different data sources) on a
plot with automatically adjusted common scales. In base graphics, if
you want to plot something as simple as points on a map, you have to
plot the map, know the x and y limits and plot the points with the
exact same limits, using several trick to superpose the plots,
suppress the plotting of axes in the second plot etc. With ggplot you
just need to add two geom calls: incredibly straightforward and
intuitive. That said, ggplot behaviour (superpose plots and adjust
scales) is the default behaviour of all other software packages I know
(MATLAB, Scilab, etc.) so it may well be that base R graphics are to
blame here, rather than ggplot being to praise. If you want to attract
R users, then this is an advantage, otherwise, this is just common
practice.
flexibility, intuitiveness, and logic of the mapping between the data
and its representation. Once one gets his mind wrapped around the
grammar of graphics concepts (and particularly the aesthetic mapping),
figuring out how to best represent a dataset is much easier than with
other graphical representation methods. For me at least, there is a
kind of *graphical construction* of the plot going on in my head
before the final code/representation. I imagine drawing lines with a
pen between data columns and graphical parameters, like in a
children's game: "so data$foo goes with x, data$bar goes with y. OK.
Then data$value could go with colour... oh but what about linking it
to size?" etc. This process, I think, helps me constructing plots that
are perceptively better or complex but still intuitive.
In addition, ggplot holds the hand of the user by proposing great
graphical representations (geoms) and easy transformations.
visual aspect. ggplots look freakin' cool! Even though I think it got
a bit worse in the last versions (title and axes titles font size and
positions not as harmonious as before, strange color choice for the
default gradient scale --from pale blue to pale beige-- which does not
stand against the background, and a few other small things) ggplots
still look very nice. The light grid on grey background helps reading
the charts and makes plots more "consistent" in the middle of text
paragraphs. The axes scales in darker grey and titles in black look
very good and tasteful. The legends are much better than anything else
I know about. Etc.
I think the big strength of ggplot2 is graphic-artist quality default
output. An an information-focussed point of view.