Warning: `qplot()` was deprecated in ggplot2 3.4.0.
p1
Plot 2: Make a histogram using ggplot
ggplot is more sophisticated than qplot, but still uses ggplot2 package (within Tidyverse) Reorder the legend so that it is not the default (alphabetical), but rather in order that months come Outline the bars in white using the color = “white” command
For plot 3 ill create side-by-side boxplots categorized by Month
fill= Month command fills each boxplot with a different color in the aesthetics scale_fill_discrete makes the legend on the side for discrete color values use “labs” to include the title, axis labels, caption for the data source
Side by Side Boxplots of Average Temperature by Month
p3 <- airquality %>%ggplot(aes(Month, Temp, fill = Month)) +labs(x ="Monthly Tempatures", y ="Tempatures", title ="Side-by-Side Boxplot of Monthly Temperatures",caption ="New York State Department of Conservation and the National Weather Service") +geom_boxplot() +scale_fill_discrete(name ="month", labels =c("May", "June","July", "August", "September"))p3
Make the same side-by-side boxplots, but in grey-scale
Use the scale_fill_grey command for the grey-scale legend, and again, use fill=Month in the aesthetics ## Side by Side Boxplots in Gray Scale
p4 <- airquality %>%ggplot(aes(Month, Temp, fill = Month)) +labs(x ="Monthly Temperatures", y ="Temperatures",title ="Side-by-Side Boxplot of Monthly Temperatures",caption ="New York State Department of Conservation and the National Weather Service") +geom_boxplot() +scale_fill_grey(name ="Month", labels =c("May", "June","July", "August", "September"))p4
Now Plot 5, showing monthly wind ranges
p5 <- airquality %>%ggplot(aes(Month, Wind, fill = Month)) +labs(x ="Monthly Wind Range", y =" Wind", title ="Side-by-Side Boxplot of Monthly Wind Range",caption ="New York State Department of Conservation and the National Weather Service") +geom_boxplot() +scale_fill_discrete(name ="month", labels =c("May", "June","July", "August", "September"))p5
Above, shows a side by side monthly comparison of different wind ranges. By using a similar Box plot from plot 3 I changed the line code from “ggplot(aes(Month, Temp, fill = Month))” to “ggplot(aes(Month, Wind, fill = Month))”. That way, the data would no longer show Temp, but instead the data for the variable wind.I also changed the presentation to match the findings of this plot. For example, i change the title, x and y names to more accurately describe this plot. I like this plot because its very pleasing to look at. The color box plots and legend is easy to identify. It’s also easy to understand the story that the graph is telling. It seems there are some outliers in June which is important to note and is highlighted by the graph.