Vis 1
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.4
q1=ggplot(data=mpg, aes(class,fill=trans))+ geom_bar()+guides(fill=guide_legend(title="transmission"))
q1
Vis 2
q2=ggplot(mpg,aes(manufacturer,hwy))+geom_boxplot()+coord_flip()+labs(y="Highway Fuel Efficiency(miles/gallon) ",x="Vehicle Manufacturer")+theme_classic()
q2
Vis 3
data("diamonds")
q3= ggplot(data = diamonds, aes(x=price, fill = cut))
q3 =q3 + geom_density(aes(colour = cut), alpha =0.3) # + scale_colour_continuous(guide = FALSE)
q3= q3 + labs(title="Diamond Price Density",x="Diamond Price (USD)", y = "Density")
q3= q3 + theme(legend.position="top")
q3
Vis 4
q4= ggplot(iris, aes(x = Sepal.Length, y = Petal.Length))
q4=q4 + geom_point(position = "jitter")+ geom_smooth(method = "lm")+theme_minimal() + labs(title="Relationship between Petal and Sepal Length", x="Iris Sepal Length", y="Iris Petal Length")
q4
Vis 5
q5 = ggplot(iris , aes(x = Sepal.Length, y= Petal.Length)) + geom_point(aes(color = Species )) + geom_smooth(aes(color = Species), method = lm, se = FALSE)
q5 = q5 + labs(title="Relationship between Petal and Sepal Length",subtitle = "Species level comparison",x="Iris Sepal Length", y = "Iris Petal Length ")
q5