Use of R built-in data mpg and library ggplot2
maufacturerNames of manufacturers should be in 90 degree angle.
ggplot(mpg, aes(x = manufacturer)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 90)) +
labs(title = "mpg Manufacturer Counts")
yearggplot(mpg, aes(x = as.factor(year))) +
geom_bar() +
labs(title = "mpg Year Counts", x = "Year")
displ, cty, hwy for each cyl levelggplot(mpg, aes(x = displ, color = as.factor(cyl))) +
geom_density() +
labs(title = "Density Curves for `displ` by `cyl`", color = "cyl")
ggplot(mpg, aes(x = cty, color = as.factor(cyl))) +
geom_density() +
labs(title = "Density Curves for `cty` by `cyl`", color = "cyl")
ggplot(mpg, aes(x = hwy, color = as.factor(cyl))) +
geom_density() +
labs(title = "Density Curves for `hwy` by `cyl`", color = "cyl")
displ by cylggplot(mpg, aes(x = as.factor(cyl), y = displ, fill = as.factor(cyl))) +
geom_boxplot() +
labs(title = "Boxplots for `displ` by `cyl`") +
theme(legend.position = "none")