library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 2.0.1 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
str(airquality)
## 'data.frame': 153 obs. of 6 variables:
## $ Ozone : int 41 36 12 18 NA 28 23 19 8 NA ...
## $ Solar.R: int 190 118 149 313 NA NA 299 99 19 194 ...
## $ Wind : num 7.4 8 12.6 11.5 14.3 14.9 8.6 13.8 20.1 8.6 ...
## $ Temp : int 67 72 74 62 56 66 65 59 61 69 ...
## $ Month : int 5 5 5 5 5 5 5 5 5 5 ...
## $ Day : int 1 2 3 4 5 6 7 8 9 10 ...
view(airquality)
Plot 1
p1 <- qplot(data = airquality,Temp, fill = Month, geom = "histogram", bins = 20) +
ggtitle("Airquality") +
xlab("Temperature") +
ylab("Count")
p1

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", "Semptember")) +
ggtitle("Airquality") +
xlab("Temperature") +
ylab("Count")
p2

Plot 3
p3 <- airquality %>%
ggplot(aes(Month, Temp, fill = Month)) +
ggtitle("Temperatures") +
xlab("Months") +
ylab("Frequency") +
geom_boxplot() +
scale_fill_discrete(name = "Month", labels = c("May", "June", "July", "August", "Semptember"))
p3
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?

Plot 4
p4 <- airquality %>%
ggplot(aes(Month, Temp, fill = Month)) +
ggtitle("Temperature") +
xlab("Months") +
ylab("Frequency") +
geom_boxplot() +
scale_fill_grey(name = "Month", labels = c("May", "June", "July", "August", "Semptember"))
p4
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?

Plot 5
p5 <- airquality %>%
ggplot(aes(Day, Temp)) +
geom_point(aes(color = Month)) +
ggtitle("Temperature throughout each Month") +
labs(x = "Days",
y = "Temperatures")
p5

Plot 5.5
p5.5 <- airquality %>%
ggplot(aes(Day, Temp)) +
geom_point(aes(color = Month)) +
geom_smooth(group = 1, alpha = .1, method = loess, formula = y ~ x) +
facet_wrap(~Month, nrow = 4, scale = "free_y") +
ggtitle("Average Temperature each Month") +
labs(x = "Days",
y = "Temperatures")
p5.5
