This strip style renders the strips as text with fitted boxes onto the panels of the plot. This is in contrast to strips that match the panel size and are located outside the panels.
strip_tag(
clip = "inherit",
order = c("x", "y"),
just = c(0, 1),
text_x = NULL,
text_y = element_text(angle = 0),
background_x = NULL,
background_y = NULL,
by_layer_x = FALSE,
by_layer_y = FALSE
)
A character(1)
that controls whether text labels are clipped to
the background boxes. Can be either "inherit"
(default), "on"
or
"off"
.
Either c("x", "y")
or c("y", "x")
, setting the top-to-bottom
order of horizontal versus "vertical" labels in facets with a grid layout.
A <numeric[2]>
setting the horizontal and vertical
justification of placing the textbox.
A list()
with
element_text()
elements. See details.
A list()
with
element_rect()
elements. See details.
A logical(1)
that when TRUE
, maps the
different elements to different layers of the strip. When FALSE
, maps the
different elements to individual strips, possibly repeating the elements
to match the number of strips through rep_len()
.
A StripTag
ggproto object that can be given as an argument to
facets in ggh4x.
Other strips:
strip_nested()
,
strip_split()
,
strip_themed()
,
strip_vanilla()
# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point()
# Typical use
p + facet_wrap2(
~ class,
strip = strip_tag()
)
# Adjusting justification
p + facet_wrap2(
~ class,
strip = strip_tag(just = c(1, 0))
)
p + facet_wrap2(
~ drv + year,
strip = strip_tag()
)
# With a grid layout, you can control in which order the labels are drawn
p + facet_grid2(
"vertical" ~ "horizontal",
strip = strip_tag(order = c("x", "y")) # default
)
p +facet_grid2(
"vertical" ~ "horizontal",
strip = strip_tag(order = c("y", "x")) # invert order
)