strip_nested {ggh4x} | R Documentation |
This strip style groups strips on the same layer that share a label. It is
the default strip for facet_nested()
and
facet_nested_wrap()
.
strip_nested( clip = "inherit", size = "constant", bleed = FALSE, text_x = NULL, text_y = NULL, background_x = NULL, background_y = NULL, by_layer_x = FALSE, by_layer_y = FALSE )
clip |
A |
size |
A |
bleed |
A |
text_x, text_y |
A |
background_x, background_y |
A |
by_layer_x, by_layer_y |
A |
The display order is always such that the outermost variable is placed the furthest away from the panels. Strips are automatically grouped when they span a nested variable.
The bleed
argument controls whether lower-layer strips are allowed
to be merged when higher-layer strips are different, i.e. they can bleed
over hierarchies. Suppose the strip_vanilla()
behaviour would be the
following for strips:
[_1_][_2_][_2_]
[_3_][_3_][_4_]
In such case, the default bleed = FALSE
argument would result in the
following:
[_1_][___2____]
[_3_][_3_][_4_]
Whereas bleed = TRUE
would allow the following:
[_1_][___2____]
[___3____][_4_]
A StripNested
ggproto object that can be given as an argument to
facets in ggh4x.
Other strips:
strip_split()
,
strip_themed()
,
strip_vanilla()
# A standard plot p <- ggplot(mpg, aes(displ, hwy)) + geom_point() # Combine the strips p + facet_wrap2(vars(cyl, drv), strip = strip_nested()) # The facet_nested and facet_nested_wrap functions have nested strips # automatically p + facet_nested_wrap(vars(cyl, drv)) # Changing the bleed argument merges the "f" labels in the top-right p + facet_wrap2(vars(cyl, drv), strip = strip_nested(bleed = TRUE))