This chapter describes how to produce plots using the ggplot2 package. There is a brief introduction to the concepts underlying the Grammar of Graphics paradigm as well as a description of the functions used to produce plots within this paradigm. The distinguishing feature of the ggplot2 package is its ability to produce a very wide range of different plots from a relatively small set of fundamental components. Because ggplot2 uses grid to draw plots, this chapter describes another way to produce a complete plot using the grid system.
The ggplot2 package provides an interpretation and extension of the ideas in Leland Wilkinson’s book The Grammar of Graphics. The ggplot2 ...