Description Usage Arguments Value Examples
Retrieves the number of layers in a given plot
1 2 3 4 5 6 7 | layer_count(p)
## Default S3 method:
layer_count(p)
## S3 method for class 'ggplot'
layer_count(p)
|
p |
plot object |
number
1 2 3 4 | library(ggplot2)
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()
layer_count(p) # 1
layer_count(p + geom_smooth(method = "lm") + geom_density_2d()) # 3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.