ggiraph
ggiraph copied to clipboard
Feature Request: opts_selection_inv
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;"))
Thanks for the suggestion, definitely doable.
I would like to second this feature request.
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)