Replies: 2 comments
-
You can't really 'map' a colour to the strip background, you'd have to provide them manually. In library(ggh4x)
#> Loading required package: ggplot2
# There are 5 upper nested strips and 7 individual strips beneath
colours <- c("dodgerblue", "limegreen", "tomato", "orchid", "gold",
rep(NA, 7))
ggplot(mpg, aes(hwy, cty)) +
geom_point() +
facet_nested_wrap(
vars(cyl, year),
strip = strip_nested(
background_x = elem_list_rect(fill = colours)
)
) Created on 2023-07-18 with reprex v2.0.2 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, this is exactly what I was after, much appreciated |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I was wondering about the possibilities with setting the strip backgrounds in a nested facet. I want to set the strip background colours of upper strip whilst keeping the lower strip as is. e.g i have facet_nested_wrap(~ i + j), i just want to colour the strip background for i (and conditionally if possible based upon values of i)
Any feedback would be appreciated
Beta Was this translation helpful? Give feedback.
All reactions