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`.
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") #provide the data sourcep2
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(alpha=0.5, color ="dimgrey") +scale_fill_discrete(name ="Month", labels =c("May", "June", "July", "August", "September"))p3
Side-by-Side boxplot in grey-scale
p4 <- 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_grey(name ="Month", labels =c("May", "June", "July", "August", "September"))p4
Histogram of Solar Radiation between May to September,1973
p5 <- airquality |>ggplot(aes(x=Solar.R, fill=Month)) +geom_histogram(position="identity", alpha=0.5, binwidth =15, color ="white") +scale_fill_discrete(name ="Month", labels =c("May", "June", "July", "August", "September")) +labs(x ="Monthly Solar Radiation in Langleys (Ly) from May - Sept", y ="Frequency of Solar.R", title ="Histogram of Monthly Solar Radiation from May - Sept, 1973", caption ="New York State Department of Conservation and the National Weather Service") p5
Warning: Removed 7 rows containing non-finite outside the scale range
(`stat_bin()`).
I chose to show Solar Radiation during the months May through September of 1973 in a histogram. The x-axis is solar radiation in Langleys and the y-axis is the frequency of each Langley per month. I changed the binwidth to 15 to better display the monthly frequencies of solar radiation.
ScatterPlot of Monthly Solar Radiation
p6 <- airquality |>ggplot(aes(x=Day, y=Solar.R, color=Month)) +geom_point(size=2) +geom_density_2d() +scale_fill_discrete(name ="Month", labels =c("May", "June", "July", "August", "September")) +labs(y ="Solar Radiation in Langleys (Ly)", x ="Days of each Month", title ="Scatterplot of Solar Radiation per day from May - Sept, 1973", caption ="New York State Department of Conservation and the National Weather Service") p6
Warning: Removed 7 rows containing non-finite outside the scale range
(`stat_density2d()`).
Warning: Removed 7 rows containing missing values or values outside the scale range
(`geom_point()`).
I thought the histogram was comprehensive and nice to look at but the multiple overlapping colors was hard for me to differentiate the frequencies in solar radiation from one month to the other. So I decided to do a scatterplot for fun, where the x-axis is the days of the month and the y-axis is Solar.R in Ly. It turned out even messier, especially with the addition of geom_density_2d. I thought it would display the density of all the months combined. The boxplot probably would’ve displayed this dataset the best.