strip_split | R Documentation |
This strip style allows a greater control over where a strip is placed relative to the panel. Different facetting variables are allowed to be placed on different sides.
strip_split(
position = c("top", "left"),
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
)
position |
A |
clip |
A |
size |
A |
bleed |
A |
text_x , text_y |
A |
background_x , background_y |
A |
by_layer_x , by_layer_y |
A |
Using this style of strip completely overrules the strip.position
and switch
arguments.
A StripSplit
ggproto object that can be given as an argument to
facets in ggh4x.
Other strips:
strip_nested()
,
strip_themed()
,
strip_vanilla()
# A standard plot
p <- ggplot(mpg, aes(displ, hwy)) +
geom_point()
# --- Wrap examples ------
# Defaults to 1st (cyl) at top, 2nd (drv) on left
p + facet_wrap2(vars(cyl, drv), strip = strip_split())
# Change cyl to left, drv to bottom
p + facet_wrap2(vars(cyl, drv), strip = strip_split(c("left", "bottom")))
# --- Grid examples -----
# Display both strips levels on the left
p + facet_grid2(vars(drv), vars(cyl),
strip = strip_split(c("left", "left")))
# Separate the strips again
p + facet_grid2(vars(cyl, year),
strip = strip_split(c("bottom", "left")))
# Using a dummy variable as a title strip
p + facet_grid2(vars(cyl, "year", year),
strip = strip_split(c("bottom", "left", "left")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.