Learn R Programming

ggiraph (version 0.6.1)

opts_selection: selection effect settings

Description

Allows customization of the rendering of selected graphic elements.

Usage

opts_selection(css = NULL, type = "multiple", only_shiny = TRUE)

Arguments

css

css to associate with elements when they are selected.

type

selection mode ("single", "multiple", "none") when widget is in a Shiny application.

only_shiny

disable selections if not in a shiny context.

See Also

set options with girafe_options

Other girafe animation options: opts_hover, opts_toolbar, opts_tooltip, opts_zoom

Examples

Run this code
# 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