#Vis 1
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.2
library(datasets)
ggplot(mpg, aes(class, fill = trans)) +
geom_bar()
#Vis 2
ggplot(data = mpg, mapping = aes(x = manufacturer, y = hwy)) +
geom_boxplot() +
coord_flip() +
labs(x="Vehicle Manufacturer") +
labs(y="Highway Fuel Efficiency (miles/gallon)") +
theme_classic()
#Vis 3
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 3.5.3
ggplot(data = diamonds, aes(x=price, colour=cut, fill=cut)) +
geom_density(alpha=0.3) +
labs(title = "Diamond Price Density") +
theme_economist()
#Vis 4
ggplot(data=iris, aes(x=Sepal.Length, y=Petal.Length)) +
geom_point() +
labs(x="Iris Sepal Length", y="Iris Petal Length")+
geom_smooth(method = "lm")+
theme_light()
#Vis 5
ggplot(data=iris, aes(x=Sepal.Length, y=Petal.Length, colour=Species)) +
geom_point() +
labs(title = "Relationship between Iris Petal and Sepal Length", subtitle = "Species Level comparision", x="Iris Sepal Length", y="Iris Petal Length")+
geom_smooth(method = "lm", se=FALSE) +
theme_tufte() +
theme(legend.position = "bottom")