remove_geom | R Documentation |
Remove geom layer from ggplot. Based on https://stackoverflow.com/questions/13407236/remove-a-layer-from-a-ggplot2-chart
remove_geom(ggplot2_object, geom_type)
ggplot2_object |
ggplot2 object |
geom_type |
d <- data.frame(
x = runif(10),
y = runif(10),
label = sprintf("label%s", 1:10))
# ggplot with geom_text_repel from ggrepel
p <- ggplot(d, aes(x, y, label = label)) +
geom_point() +
geom_text()
# Remove the labels added by ggrepel.
p <- remove_geom(p, "GeomText")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.