is_any_layer_class {spinifex} | R Documentation |
Check ggplot layers for use of a specific geom
Description
Checks if any of the layers of a ggplot contain a specific class.
Usage
is_any_layer_class(ggplot, class_nm = "GeomDensity")
Arguments
ggplot |
Check the layers of this ggplot object |
class_nm |
The class name to check, note this differs slightly from the name of the geom function. Defaults to "GeomDensity", checking to see if geom_density was used in any of the layers. |
See Also
ggplot2::theme
for all theme options.
Examples
library(ggplot2)
library(spinifex)
g <- ggplot(mtcars, aes(disp, color = factor(cyl))) +
geom_density() + geom_histogram()
is_any_layer_class(g, "GeomDensity")
is_any_layer_class(g, "GeomPoint")
[Package spinifex version 0.3.7.0 Index]