Quarto Computations

Author

Lauryn Bull

This dataset contains a subset of the fuel economy data from the EPA. Specifically, we use the mpg dataset from the ggplot2 package.

There are 234 observations in our data.

The average city mileage of cars in our data is 16.86 and the average highway mileage in 23.44.

The plots in Figure 1 show the relationship between the the city and the highway mileage for 38 popular models of cars . In Figure 1 (a) the points are coloured by the number of cylinders while the Figure 1 (b) then points are coloured by the engine displacement.

Code
ggplot(mpg, aes(x = hwy, y = cty, color = cyl)) +
  geom_point(alpha = 0.5, size = 2) +
  scale_color_viridis_c() +
  theme_minimal()

ggplot(mpg, aes(x = hwy, y = cty, color = displ)) +
  geom_point(alpha = 0.5, size = 2) +
  scale_color_viridis_c(option = "E") +
  theme_minimal()

(a) Colour by number of cylinders

(b) Colour by engine displacement, in liters

Figure 1: City and highway mileage for the 38 popular modesl of cars.