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 sourcep1
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
This plot is not the most helpful when it comes to answering questions about monthly temperature values because it is difficult to discern one month from another.
Plot 2
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")p2
While this somewhat improves the readability of the plot, I think that the darker colors which occur due to overlap could confuse the viewer as those colors are not marked on the legend.
Plot 3
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"))p3
Plot 4
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
Plot 5
p5 <- airquality |>ggplot(aes(Ozone, Temp)) +labs(x ="Ozone in ppb", y ="Temperature in F", title ="Scatterplot of Temperature and Ozone Levels",caption ="New York State Department of Conservation and the National Weather Service") +geom_point()p5
The plot that I have created shows the correlation between recorded temperature levels in Fahrenheit compared to recorded ozone levels in ppb. It is a scatterplot and I used the geom_point() function under ggplot in order to obtain this plot. I was sure to include a title as well as labeling for my axis and a caption to inform the viewer where the information was from.