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)ggplot(data=iris,
mapping=aes(x=Sepal.Length,
y=Petal.Length, color=Species))+
ggtitle("Iris")+
geom_point()+
gg_("facet by Species vertical", data = iris)