Closed SimonW22 closed 10 months ago
Sure, just use strip_nested()
instead of strip_themed()
. Example:
library(ggh4x)
#> Loading required package: ggplot2
p <- ggplot(mpg, aes(displ, hwy, colour = as.factor(cyl))) + geom_point()
ridiculous_strips <- strip_nested(
# Horizontal strips
background_x = elem_list_rect(fill = c("limegreen", "dodgerblue")),
text_x = elem_list_text(colour = c("dodgerblue", "limegreen"),
face = c("bold", "bold")),
by_layer_x = TRUE,
# Vertical strips
background_y = elem_list_rect(
fill = c("gold", "tomato", "deepskyblue")
),
text_y = elem_list_text(angle = c(0, 90)),
by_layer_y = FALSE
)
p + facet_grid2(class ~ drv + year, strip = ridiculous_strips)
Created on 2023-09-08 with reprex v2.0.2
Thank you for the clarification. It worked as intended.
This may be a known issue. Based on your example plot here https://teunbrand.github.io/ggh4x/articles/Facets.html#themed-strips
Is it possible to color the strips without breaking the overlap? For example, can you add color so that the outer rows in the example plot 4,f,r are joined rather than split?