ggplot is based on a grammar graphics - a way of approaching describing the construction of a graphic from common building blocks. Building a graphic with ggplot then follows some common patterns of construction.
At its most basic, we supply ggplot with a dataset and some aesthetics–that is, the variables we wish to display on the plot and how they should appear. Laslty, we define a plot type.
Step by step this looks like
- call ggplot()
- provide ggplot with a data set
- provide ggplot with the variables of interest and their aesthetic properties
- define a plot type with geom_plotType()
This is a brief introduction. For more in depth examples and solutions, check out ggplot2: Elegant Graphics for Data Analysis by Hadley Wickham, Danielle Navarro, and Thomas Lin Pedersen.