The objectives of this problem set is to gain experience working with the ggplot2 package for data visualization. To do this I have provided a series of graphics, all created using the ggplot2 package. Your objective for this assignment will be write the code necessary to exactly recreate the provided graphics.
When completed submit a link to your file on rpubs.com. Be sure to include echo = TRUE for each graphic so that I can see the visualization and the code required to create it
library(datasets, lib.loc="C:/software/Rpackages")
library(ggplot2, lib.loc="C:/software/Rpackages")
ggplot(mpg, aes(class, fill = trans)) + geom_bar(position = "stack") + scale_fill_discrete(name = "Transmission")
ggplot(mpg, aes(manufacturer, hwy)) + geom_boxplot() + coord_flip() + labs( x = "Vehicle Manufacturer", y = "Highway Fuel Efficiency (miles/gallon)") + theme_classic()
library(ggthemes, lib.loc="C:/software/Rpackages")
ggplot(diamonds, aes(price, color=cut,fill=cut))+geom_density(alpha=.2)+theme_economist() +labs (x = "Diamond Price (USD)", y = "Density", title= "Diamond Price Density")
ggplot(iris,aes(Sepal.Length,Petal.Length))+geom_point()+geom_smooth(method = lm) + theme_minimal()+labs (x = "Iris Sepal Length", y = "Iris Petal Length", title= "Relationship between Sepal and Petal Length")
ggplot(iris,aes(Sepal.Length,Petal.Length, color=Species,fill=Species))+geom_point()+geom_smooth(method = lm,se=FALSE) + theme_minimal()+theme(legend.position="bottom")+labs (x = "Iris Sepal Length", y = "Iris Petal Length", title= "Relationship between Sepal and Petal Length", subtitle="Species Level Comparison")