I can create a faceted plot like so, with 3 plots stacked vertically:
ggplot(iris, aes(Petal.Length)) + stat_bin() + facet_grid(Species ~ .)
Is it possible to move the labels to the top of each graph, like they would be if I'd done horizontal stacking with facet_grid(. ~ Species)
?
The reason I want this is that my plots are long time series plots, so I want the full width for each one, but the labels (which essentially function as titles to explain the facets) for each plot are too long to fit in the small label area at the right of the plot.
Yes. Use facet_wrap
instead of facet_grid
and be sure to also specify the argument ncol=1
:
ggplot(iris, aes(Petal.Length)) + stat_bin() + facet_wrap(~Species, ncol=1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With