9.2 Aesthetic mappings

  • We will be working with the mpg data frame that is bundled with the ggplot2 package which contains 234 observations collected by the US Environmental Protection Agency on 38 car models. Among the variables in mpg are:

    -displ: A car’s engine size, in liters. A numerical variable.

    -hwy: A car’s fuel efficiency on the highway, in miles per gallon (mpg). A car with a low fuel efficiency consumes more fuel than a car with a high fuel efficiency when they travel the same distance. A numerical variable.

    -class: Type of car. A categorical variable.