ggiraph icon indicating copy to clipboard operation
ggiraph copied to clipboard

Feature Request: opts_selection_inv

Open tanho63 opened this issue 4 years ago • 1 comments

I love the opts_hover_inv option and would like a parallel implementation for selection (instead of just hover) to be able to de-emphasize non-selected points

usage might be exactly the same, i.e.

options = list(opts_selection_inv(css = "opacity:0.1;"))

tanho63 avatar Mar 15 '21 14:03 tanho63

Thanks for the suggestion, definitely doable.

sigmapi avatar Mar 15 '21 14:03 sigmapi

I would like to second this feature request.

dleopold avatar Sep 06 '22 21:09 dleopold

This is now done, here is a quick example (it requires the latest github version of ggiraph):

library(ggiraph)
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;",
    only_shiny = FALSE
  ),
  opts_selection_inv(
    css = "opacity:0.5;"
  )
)
if (interactive()) print(x)

sigmapi avatar Sep 08 '22 16:09 sigmapi