Grammar of Graphics Foundations

Almost every plot you have ever seen in R, no matter how simple or complicated, is built from the same small set of ingredients: some data, a description of how variables map onto visual properties, and a choice of geometry that draws the actual shapes. ggplot2 calls this recipe the grammar of graphics.

In this tutorial you will:

Throughout, we’ll use the mpg dataset (built into ggplot2), which contains fuel economy data for 234 cars.

Back to top