tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.48k stars 2.02k forks source link

More sorting options for `facet_wrap()` #5855

Closed teunbrand closed 5 months ago

teunbrand commented 5 months ago

This PR aims to fix #5212.

Briefly, it adds more options for the dir argument to layout the panels in various ways. The as.table argument gets absorbed into dir when the previous way of declaring dir = "v" or dir = "h" is used.

The new options for dir are:

Using as.table with any of the options above has no effect.

As an example where blank panels are set at the beginning:

devtools::load_all("~/packages/ggplot2")
#> ℹ Loading ggplot2

ggplot(mpg, aes(displ, hwy)) +
  geom_point() +
  facet_wrap(~ class, dir = "rb")

Created on 2024-04-22 with reprex v2.1.0

teunbrand commented 5 months ago

Good idea thanks!