using ggplot to generate plot of
#boxplot
boxplot<- ggplot(ToothGrowth, aes(x = dose, y = len)) +
geom_boxplot()
#boxplot coloured using factor variable
bxp <- ggplot(ToothGrowth, aes(x = dose, y = len)) +
geom_boxplot(aes(fill = dose))
bxp
scatterplot<-ggplot(mtcars, aes(wt, mpg)) +
geom_point()
ggplot have some number of themes that can be used
theme_classic()~x and y axis lines and no gridlines.
theme_minimal() ~no background annotations
theme_bw()
theme_dark() ~ a dark background
theme_void() ~completely empty
extra themes can be got from the ggthemes package
this comes with:
*theme_tufte*()~a minimalist theme
*theme_economist()~theme based on the plots in the economist magazine*
*theme_hc()~theme based on stata graph schemes*
theme_stata()~theme based on Highcharts JS
themes can be called using the