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 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")
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"))
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"))
PLot 5
airquality$Month[airquality$Month ==5] <-"May"airquality$Month[airquality$Month ==6] <-"June"airquality$Month[airquality$Month ==7] <-"July"airquality$Month[airquality$Month ==8] <-"August"airquality$Month[airquality$Month ==9] <-"September"ggplot(data = airquality, mapping =aes(x = Temp, y = Solar.R, color = Month)) +geom_point() +ggtitle("Temperature and Solar Radiation Correlations by Month") +scale_color_manual(values =c("May"="green", "June"="purple", "July"="red", "August"="brown", "September"="navy"))
Warning: Removed 7 rows containing missing values or values outside the scale range
(`geom_point()`).
For the fifth plot I decided to make a scatterplot that showed any correlation between Solar and the tempure Judging by the visualization, there seems to be an overall correlation between solar rates and a rise in temperature. I also color-coded each month to see how each month compares to one another. The biggest outlier would be the month of May, which was the one month that didn’t have any strong correlation between temperature and solar. To label each month are used the scale_color_manuel code which also auto generated a legend.