Histogram categorized by Month using qplot

p1 <- qplot(data = airquality,Temp,fill = Month,geom = "histogram", bins = 20)
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
p1

Histogram using ggplot

p2 <- airquality %>%
  ggplot(aes(x=Temp, fill=Month)) +
  geom_histogram(position="identity", alpha=0.5, binwidth = 5, color = "white")+
  scale_fill_discrete(name = "Month", labels = c("May", "June","July", "August", "September"))
p2

Side by Side Boxplots Categorized by Month

p3 <- airquality %>%
  ggplot(aes(Month, Temp, fill = Month)) + 
  ggtitle("Temperatures") +
  xlab("Monthly Temperatures") +
  ylab("Frequency") +
  geom_boxplot() +
  scale_fill_discrete(name = "Month", labels = c("May", "June","July", "August", "September"))
p3 

Side-by-Side Boxplots in Grey-scale

p4 <- airquality %>%
  ggplot(aes(Month, Temp, fill = Month)) + 
  ggtitle("Monthly Temperature Variations") +
  xlab("Monthly Temperatures") +
  ylab("Frequency") +
  geom_boxplot()+
  scale_fill_grey(name = "Month", labels = c("May", "June","July", "August", "September"))
p4

Side-by-Side Boxplots of Ozone Levels Categorized by Month

p5 <- airquality %>%
  ggplot(aes(Ozone, Month, fill = Month)) +
  ggtitle("Monthly Ozone Levels") +
  xlab("Ozone Level") +
  ylab("Month") +
  geom_boxplot() +
  scale_fill_discrete(name = "Month", labels = c("May", "June","July", "August", "September"))
p5 
## Warning: Removed 37 rows containing non-finite values (`stat_boxplot()`).

Plot 5, or “Monthly Ozone Levels,” uses side-by-side boxplots to show Ozone levels categorize by months. The months are color-coordinated to help with visualization. As you can see, July and August clearly are the months with the highest Ozone levels and the months where Ozone levels varied the most. On the other hand, September, June, and May have very low levels, all under 50, except for minimal outliers. —

For my code, I had to make modifications to the ggplot replacing the “x,y” values in the aes() from(Month, Temp, fill = Month)) to (Ozone, Month, fill = Month)). This replaced the x value Temp with Month and y value from Month to Ozone, keeping the fill = month rotated the boxplots from being vertical to horizontal, an easier way to view this data. The next modifications I made were to the ggtitle, xlab, and ylab. I created a more appropriate title, “Monthly Ozone Levels” and correctly labeled the x and y axis with “Ozone Level” and “Month”. These were all the necessary changes made to my code in order to generate plot 5.