facets.Rmd
Faceting requires the optional parameter data
be given either the original dataset used in your ggplot()
call, or a vector of column names (the output of names({your dataset here})
).
It defaults to facet_wrap()
over facet_grid()
.
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
ggtitle("Iris")+
geom_point()+
gg_("facet by Species", data = iris)
#> Registered S3 method overwritten by 'sets':
#> method from
#> print.element ggplot2
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
ggtitle("Iris")+
geom_point()+
gg_("facet by Species vertical", data = iris)
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
ggtitle("Iris")+
geom_point()+
gg_("facet by Species 2 cols", data = iris)
ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
ggtitle("Iris")+
geom_point()+
gg_("grid by Species and Petal.Width", data = iris)