get_geoms: List the geoms used by a plot

View source: R/geoms.R

get_geomsR Documentation

List the geoms used by a plot

Description

get_geoms returns a vector of geom names, written as character strings, that describes which geoms in which order are used by a plot.

Usage

get_geoms(p)

Arguments

p

A ggplot object

Value

A vector of character strings. Each element corresponds to the suffix of a ggplot2 geom_ function, e.g. c("point", "line", "smooth").

See Also

Other functions for checking geoms: get_geoms_stats(), ith_geom_is(), ith_geom_stat(), ith_geom(), uses_geoms()

Examples

require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
  geom_point(mapping = aes(color = class)) +
  geom_smooth()
get_geoms(p)

rstudio-education/ggcheck documentation built on May 12, 2023, 11:33 a.m.