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 `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")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 #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"))p4
Plot 5: Side by Side Boxplots of moth and wind speed
p5<- airquality |>ggplot(aes(x = Month, y = Wind, fill = Month)) +geom_boxplot() +labs(title =" Wind Speed Across Summer Months",x ="Month",y ="Wind speed (mph)")p5
Airquality dataset contains environmental characteristics of New York city in order to determine it’s airquality. Plot 5, the last plot, depicts whether the summer month gets windier as time goes by. The dataset contains the average wind speed recorded from May to September. Those two variables are visualized through the box plot above using ggplot to give interesting insights about the observations. The box plot illustrates metrics like median, quartiles, maximum, and minimum values of each observations recorded for each month. For example, months like May, August and September have more disperse values recorded than July and June, due to the width of their boxes being wider. In other words, the average wind speed in June and July were closer and similar than the average wind speed in May, August, and September. Also, though may is shown to have the highest wind speed of the summer, there is no evident relationship or pattern, to argument the idea that New York get’s windier as the summer goes by. For example July is smaller in width and maximum value than August.