strip_tag {ggh4x} | R Documentation |
Strips as tags
Description
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.
Usage
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
)
Arguments
clip |
A |
order |
Either |
just |
A |
text_x , text_y |
A |
background_x , background_y |
A |
by_layer_x , by_layer_y |
A |
Value
A StripTag
ggproto object that can be given as an argument to
facets in ggh4x.
See Also
Other strips:
strip_nested()
,
strip_split()
,
strip_themed()
,
strip_vanilla()
Examples
# 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
)