get_title: Get plot titles

View source: R/get_titles.R

get_titleR Documentation

Get plot titles

Description

These functions extract just the titles from a ggplot. get_title() pulls the title, while get_subtitle() pulls the subtitle.

Usage

get_title(plot)

get_subtitle(plot)

Arguments

plot

A ggplot or gtable.

Examples

library(ggplot2)

p <- ggplot(mpg, aes(displ, cty)) +
  geom_point() +
  labs(
    title = "Plot title",
    subtitle = "Plot subtitle"
  )
ggdraw(get_title(p))
ggdraw(get_subtitle(p))


wilkelab/cowplot documentation built on Jan. 28, 2024, 11:19 a.m.