I've been reading the ggplot2
documentation for both functions. I was wondering what were the differences and what would be right situation for using each function (facet_wrap()
and facet_grid()
).
library(ggplot2)
p <- qplot(displ, hwy, data = mpg)
p + facet_wrap(~ cyl)
p + facet_grid(~ cyl)
I provide this small example to serve as starting point. The difference seems to be wrap makes the plots more autonomous and grid makes one plot all together.
See Question&Answers more detail:os