teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
542 stars 33 forks source link

Nested facet_wrap() #19

Closed teunbrand closed 3 years ago

teunbrand commented 4 years ago

Basically the strip merging of facet_nested() but then in a facet wrap layout. Should be doable to adapt/clone + adapt the strip merging logic from facet_nested() to do the same to wrapped facets. Probably have to constrain the merging to panel rows/columns somehow. A limitation would be that when grouped panels are placed in seperate rows/column, there is no elegant merging of strips to be done.

There seems to be some demand for it:

teunbrand commented 3 years ago

This should now be possible:

library(ggh4x)
#> Loading required package: ggplot2

ggplot(mpg, aes(displ, hwy)) +
  geom_point() + 
  facet_nested_wrap(vars(cyl, drv))

Created on 2020-08-12 by the reprex package (v0.3.0)