Learn R Programming

colorrepel (version 0.4.3)

get_labs: Extract custom labels from ggplot object

Description

Extract custom labels from ggplot object

Usage

get_labs(g, ggbuild = NULL)

Value

named vector of labels

Arguments

g

ggplot object

ggbuild

already built ggplot_built object if available

Examples

Run this code
a <- ggplot2::ggplot(ggplot2::mpg, ggplot2::aes(displ, hwy)) +
  ggplot2::geom_point(ggplot2::aes(color = as.factor(cyl))) +
  ggplot2::geom_text(ggplot2::aes(label = model))
get_labs(a)

Run the code above in your browser using DataLab