Chapter 3. The Layers and Grammar of Graphics
In this chapter, we will take a closer look at the grammar of graphics as implemented in ggplot2
. We will go through the main concepts of the layer approach that will help you to understand and master the full potential of the basic qplot
function which we were introduced to in Chapter 2, Getting Started. After a general introduction to the different components of the grammar of graphics, we will go deeper into the faceting, coordinate system, scales, and concept of layers in dedicated sections of this chapter. Afterwards, we will have a look at how you can use the ggplot()
function and how its code relates to the one you have already seen used with the simplified qplot()
function.