Description Usage Arguments Examples
Removes specified layers from a ggplot object.
1 | 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 |
1 2 3 4 5 | 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
|
Loading required package: shiny
Loading required package: shinyBS
Loading required package: ggplot2
Loading required package: dplyr
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.