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().
Usage
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
)Arguments
- clip
A
character(1)that controls whether text labels are clipped to the background boxes. Can be either"inherit"(default),"on"or"off".- size
A
character(1)stating that the strip margins in different layers remain"constant"or are"variable".- bleed
A
logical(1)indicating whether merging of lower-layer variables is allowed when the higher-layer variables are separate. See details.- text_x, text_y
A
list()withelement_text()elements. See the details section instrip_themed().- background_x, background_y
A
list()withelement_rect()elements. See the details section instrip_themed().- by_layer_x, by_layer_y
A
logical(1)that whenTRUE, maps the different elements to different layers of the strip. WhenFALSE, maps the different elements to individual strips, possibly repeating the elements to match the number of strips throughrep_len().
Details
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_]
See also
Other strips:
strip_split(),
strip_tag(),
strip_themed(),
strip_vanilla()
Examples
# 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))
