ith_geom_stat: Which geom/stat combination is used in the ith layer?

View source: R/geoms.R

ith_geom_statR Documentation

Which geom/stat combination is used in the ith layer?

Description

ith_geom_stat returns the type of geom used by the ith layer according to a geom/stat combination.

Usage

ith_geom_stat(p, i)

Arguments

p

A ggplot object

i

A numerical index that corresponds to the first layer of a plot (1), the second layer (2), and so on.

Value

A list of lists with a GEOM and STAT strings, each corresponding to the suffix of a ggplot2 geom_ function (e.g. "point"), and stat_ function (e.g. "identity"). e.g. list(list(GEOM = "point", STAT = "identity"))

See Also

Other functions for checking geoms: get_geoms_stats(), get_geoms(), ith_geom_is(), 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()
ith_geom_stat(p, i = 2)

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