Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: opts_selection_inv #191

Closed
tanho63 opened this issue Mar 15, 2021 · 3 comments
Closed

Feature Request: opts_selection_inv #191

tanho63 opened this issue Mar 15, 2021 · 3 comments
Assignees

Comments

@tanho63
Copy link

tanho63 commented Mar 15, 2021

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 tanho63 changed the title opts_selection_inv Feature Request: opts_selection_inv Mar 15, 2021
@sigmapi
Copy link
Collaborator

sigmapi commented Mar 15, 2021

Thanks for the suggestion, definitely doable.

@dleopold
Copy link

dleopold commented Sep 6, 2022

I would like to second this feature request.

@sigmapi sigmapi self-assigned this Sep 8, 2022
@sigmapi sigmapi closed this as completed in 9b07ab0 Sep 8, 2022
@sigmapi
Copy link
Collaborator

sigmapi commented Sep 8, 2022

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants