get_strip_labels: Accessing a plot's facet strip labels

View source: R/facet-.R

get_strip_labelsR Documentation

Accessing a plot's facet strip labels

Description

This functions retrieves labels from facet strips with the labeller applied.

Usage

get_strip_labels(plot = get_last_plot())

Arguments

plot

A ggplot or build ggplot object.

Value

NULL if there are no labels, otherwise a list of data.frames containing the labels.

Examples

# Basic plot
p <- ggplot(mpg, aes(displ, hwy)) +
  geom_point()

get_strip_labels(p) # empty facets
get_strip_labels(p + facet_wrap(year ~ cyl))
get_strip_labels(p + facet_grid(year ~ cyl))

tidyverse/ggplot2 documentation built on Jan. 29, 2025, 6:53 a.m.