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`.
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
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(x = Wind, y = Ozone)) +geom_point(color ="steelblue", size =2, alpha =0.7) +labs(x ="Wind Speed (mph)",y ="Ozone (ppb)",title ="Scatterplot of Ozone Levels vs Wind Speed",caption ="New York State Department of Conservation and the National Weather Service" ) +theme_minimal()p5
Warning: Removed 37 rows containing missing values or values outside the scale range
(`geom_point()`).
Essay
The plot I created is a scatterplot that shows the relationship between wind speed and ozone levels. From the plot, we can see a general trend where higher wind speeds seem to be associated with lower ozone levels. This makes sense because stronger winds might help disperse air pollutants, reducing ozone concentration in the air.
To make this plot, I used geom_point() to create the dots, and I added some style options like color = "steelblue", alpha = 0.7 for transparency, and theme_minimal() for a clean look. This is different from previous plots because it’s focused on two numerical variables and shows a potential negative correlation.