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
p1
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
##Plot 2: Improve the histogram of Average Temperature by Month
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
##Plot 3: Create side-by-side boxplots 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"))
p3
##Plot 4: 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
##Plot 5:
p5 <- airquality |>ggplot(aes(x = Temp, fill = Month)) +geom_bar(alpha=1 ,color ="black")+scale_fill_discrete(name ="Month", labels =c("May", "June", "July", "August", "September")) +labs(x ="Monthly Temperatures from May - Sept", y ="Frequency", title ="Frequency of Observations by Temps", caption ="New York State Department of Conservation and the National Weather Service") +theme(axis.text.x =element_text(angle =45))
p5
The data plot that I created shows the specific frequencey of every temerature that has been recored and seperated by each month which is color coded. This graph totals up all the same Tempratures that were recorded which gives us the frequency total but then also seperates them by months. This shows how many of the recorded temps are in a specifc month but also how much they contribute to each singular temp. I think the only code that I feel is a bit special in this case is on line #134 to make the temperatures angled which I do feel like is a nice little addition to the flow of the chart