is_any_layer_class | R Documentation |
Checks if any of the layers of a ggplot contain a specific class.
is_any_layer_class(ggplot, class_nm = "GeomDensity")
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. |
ggplot2::theme
for all theme options.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.