第二版
ggplot2 is an R package for producing statistical, or data, graphics, but it is
unlike most other graphics packages because it has a deep underlying grammar. This grammar, based on the Grammar of Graphics (Wilkinson, 2005),
is made up of a set of independent components that can be composed in
many different ways. This makes ggplot2 very powerful because you are not
limited to a set of pre-specified graphics, but you can create new graphics
that are precisely tailored for your problem. This may sound overwhelming,
but because there is a simple set of core principles and very few special cases,
ggplot2 is also easy to learn (although it may take a little time to forget your
preconceptions from other graphics tools).
Practically, ggplot2 provides beautiful, hassle-free plots that take care of
fiddly details like drawing legends. The plots can be built up iteratively and
edited later. A carefully chosen set of defaults means that most of the time
you can produce a publication-quality graphic in seconds, but if you do have
special formatting requirements, a comprehensive theming system makes it
easy to do what you want. Instead of spending time making your graph look
pretty, you can focus on creating a graph that best reveals the messages in
your data.
ggplot2 is designed to work iteratively. You can start with a layer showing
the raw data then add layers of annotations and statistical summaries. It
allows you to produce graphics using the same structured thinking that you
use to design an analysis, reducing the distance between a plot in your head
and one on the page. It is especially helpful for students who have not yet
developed the structured approach to analysis used by experts.
Learning the grammar not only will help you create graphics that you know
about now, but will also help you to think about new graphics that would
be even better. Without the grammar, there is no underlying theory, so most
graphics packages are just a big collection of special cases.
附件列表