Skip to contents

Wraps each plot in a single-panel ggh4x::facet_wrap2 so that a coloured strip label appears above the panel.

Usage

fmt_strip(plot, label = NULL, label_color = "white", label_fill = NULL)

Arguments

plot

A ggplot, patchwork, or list of ggplots.

label

Character vector of strip labels (recycled as needed).

label_color

Text colour(s) for the strip label. Default "white".

label_fill

Background fill colour(s) for the strip. If NULL, strips use a transparent background.

Value

Same type as input.

Examples

library(ggplot2)
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()
fmt_strip(p, label = "Iris Data", label_fill = "steelblue")