Is there a way to get ggplot2::facet_wrap()
to have a facet span on several rows?
I'm thinking of something very similar to what could be achieved with {patchwork}
(example).
Here is a very lame example with 3 facets:
library(tidyverse)
mtcars %>%
select(cyl, am, gear, carb) %>% pivot_longer(-cyl) %>%
ggplot(aes(fill=name, x=value)) +
geom_bar(position="dodge") +
facet_wrap("cyl", scale="free")
Created on 2021-07-05 by the reprex package (v2.0.0)
In this example, how could I have these facets on 2 rows with first cyl==4&6
on 1 column each, and then cyl==8
which would span on 2 columns?
Here is my expected output (beware of my mighty MS Paint skills):