Skip to content

List the geom and stat combination used by all layers of a plot.

Usage

get_geoms_stats(p)

Arguments

p

A ggplot object

Value

A list of lists with a GEOM and STAT character. e.g. list(list(GEOM = "point", STAT = "identity"))

See also

Other functions for checking geoms: get_geoms(), 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_stats(p)
#> [[1]]
#> $GEOM
#> [1] "point"
#> 
#> $STAT
#> [1] "identity"
#> 
#> attr(,"class")
#> [1] "GEOM_STAT"
#> 
#> [[2]]
#> $GEOM
#> [1] "smooth"
#> 
#> $STAT
#> [1] "smooth"
#> 
#> attr(,"class")
#> [1] "GEOM_STAT"
#>