View source: R/ggplot_functions.R
hide_geoms | R Documentation |
Hides all the geoms on the graph while keeping everything else (e.g.,
the scaling, the legends, the titles, etc.) the same.
Useful for when, in a talk, you want to explain to the audience what
they are about to see, while acquainting them with the legends, etc.
hide_geoms(gg_obj)
gg_obj |
The |
Currently, this just goes through each layer of data and sets the
size
and alpha
to 0. This hasn't been tested at edge cases.
a gtable
object (which you can plot)
a <- dplyr::tibble( alp=runif(120,0,3), bet=alp*2+1, gam=rbinom(120,1,0.5)) b <- dplyr::tibble( alp=runif(120,3,10), bet=-alp*2+10, gam=rbinom(120,1,0.5)) g <- a %>% ggplot2::ggplot(aes(x=alp,y=bet, color=as.factor(gam))) + ggplot2::geom_point() + ggplot2::geom_vline(xintercept = 5) + ggplot2::geom_line(data=b) plot(g) plot(hide_geoms(g))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.