remove_geom | R Documentation |
Removes specified layers from a ggplot object.
remove_geom(p, geom, idx = NULL)
p |
ggplot2 plot object |
geom |
character string of the name of the layer to remove |
idx |
numeric of which index of geom to remove, Default: 1 |
p <- ggplot2::ggplot(iris,ggplot2::aes(x =Sepal.Length,y=Sepal.Width))
p <- p+ggplot2::geom_point(ggplot2::aes(colour=Species))+ggplot2::geom_line()
p
pnew <- p |> remove_geom('point',1)
pnew
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.