Sylvie’s Corner

We’re getting married! https://torlakova-molino.com

Air Quality

Figure 1 further explores the impact of temperature on ozone level.

Code
ggplot(airquality, aes(Temp, Ozone)) + 
  geom_point() + 
  geom_smooth(method = "loess")
Figure 1: Temperature and ozone level.

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

Figure 2 shows a positive, strong, and linear relationship between the city and highway mileage of these cars. Additionally, mileage is higher for cars with fewer cylinders.

Code
ggplot(mpg, aes(x = hwy, y = cty, color = cyl)) +
  geom_point(alpha = 0.5, size = 2) +
  scale_color_viridis_c() +
  theme_minimal()
Scatterplot of city vs. highway mileage for cars, where points are colored by the number of cylinders. The plot displays a positive, linear, and strong relationship between city and highway mileage, and mileage increases as the number of cylinders decreases.
Figure 2: City and highway mileage for 38 popular models of cars.

The plots in Figure 3 show the relationship between city and highway mileage for 38 popular models of cars. In Figure 3 (a) the points are colored by the number of cylinders while in Figure 3 (b) the points are colored by 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) Color by number of cylinders
(b) Color by engine displacement, in liters
Figure 3: City and highway mileage for 38 popular models of cars.