n_layers | R Documentation |
How many layers are in a plot?
n_layers(p)
p |
A ggplot object |
Numeric. The number of layers.
require(ggplot2)
p <- ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth()
n_layers(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.