get_title: Get plot titles

Description Usage Arguments Examples

View source: R/get_titles.R

Description

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

Usage

1
2
3

Arguments

plot

A ggplot or gtable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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))

cowplot documentation built on Dec. 30, 2020, 5:07 p.m.