View source: R/interactive-ggproto.R
active | R Documentation |
active
componentSet active
and/or activeGeomLayers
active(active = NULL, activeGeomLayers = NULL)
active |
a logical or a logical vector of length |
activeGeomLayers |
determine which geom layer is interactive by its 'geom_...' position in the grammar of the expression.
Currently, only |
a ggproto
object
linking
, selection
, zoom
,
hover
, interactivity
if(interactive()) {
# set active layer
l_ggplot(mtcars, aes(mpg, wt, shape = factor(cyl))) +
geom_point(colour = "black", size = 4.5) +
geom_point(colour = "pink", size = 4) +
geom_point(aes(shape = factor(cyl))) +
# only show manual transmission cars
# in the second interactive layer
active(active = mtcars$am == 1,
activeGeomLayers = 2)
# Then, click the `reactivate` button on loon inspector
# to display all interactive points
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.