Last chance! 50% off unlimited learning
Sale ends in
Allows customization of the rendering of selected graphic elements.
opts_selection(css = NULL, type = "multiple", only_shiny = TRUE)
css to associate with elements when they are selected.
selection mode ("single", "multiple", "none") when widget is in a Shiny application.
disable selections if not in a shiny context.
set options with girafe_options
Other girafe animation options: opts_hover
,
opts_toolbar
, opts_tooltip
,
opts_zoom
# NOT RUN {
library(ggplot2)
dataset <- mtcars
dataset$carname = row.names(mtcars)
gg <- ggplot(
data = dataset,
mapping = aes(x = wt, y = qsec, color = disp,
tooltip = carname, data_id = carname) ) +
geom_point_interactive() + theme_minimal()
x <- girafe(ggobj = gg)
x <- girafe_options(x,
opts_selection(type = "multiple",
css = "fill:red;stroke:gray;r:5pt;") )
if( interactive() ) print(x)
# }
Run the code above in your browser using DataLab