p1 <- airquality |>ggplot(aes(x=Temp, fill=Month)) +geom_histogram(position="identity")+scale_fill_discrete(name ="Month", labels =c("May", "June","July", "August", "September")) +labs(x ="Monthly Temperatures from May - Sept", y ="Frequency of Temps",title ="Histogram of Monthly Temperatures from May - Sept, 1973",caption ="New York State Department of Conservation and the National Weather Service") #provide the data source
Plot 1 Output
p1
`stat_bin()` using `bins = 30`. Pick better value `binwidth`.
Plot 2: Improve the histogram of Average Temperature by Month
Plot 2 Code
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")) +labs(x ="Monthly Temperatures from May - Sept", y ="Frequency of Temps",title ="Histogram of Monthly Temperatures from May - Sept, 1973",caption ="New York State Department of Conservation and the National Weather Service")
Plot 2 Output
p2
Plot 3: Create side-by-side box plots categorized by Month
p3 <- airquality |>ggplot(aes(Month, Temp, fill = Month)) +labs(x ="Months from May through September", 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_discrete(name ="Month", labels =c("May", "June","July", "August", "September"))
Plot 3 Output
p3
Plot 4: Side by Side Box plots in Grey Scale
Plot 4 Code
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"))
Plot 4 Output
p4
Plot 5: Side-By-Side Box plot of Monthly Wind Speed
p5 <- airquality |>ggplot(aes(Month, Wind, fill = Month)) +labs(x ="Monthly Wind Speed", y ="Wind Speed", title ="Side-by-Side Boxplot of Monthly Wind Speed",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
Essay
The Plot type I have created is a side-by-side box plot showcasing the average wind speed per each month. This box plot utilizes the discrete colour package to highlight the months.The x axis displays the months while the y axis showcases the wind speed.
Using this box plot, we can understand that the month of May experienced the highest average of wind speeds in comparison to the other months, while August and July seemingly tied for the lowest. We can also see that June had 2 outliers, these being the lowest and highest wind speeds in a single day in comparison to the other months.
The special code I used for this box plot was the change in the aes section where I inputted wind, alongside the changes in titles to showcase the graph was displaying wind speed. Other than that, I did not change anything else in comparison to the previous 2 box plots.