Dimming of unselected points by both plotly and crosstalk makes points progressively fade away.
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
When I use crosstalk, selecting a rectangle multiple times causes other points to progressively dim away.
remotes::install_github("plotly/plotly.R")
library(plotly)
shared_data <- highlight_key(mtcars)
p <- ggplot(shared_data)+aes(cyl, mpg)+geom_point()
# Unselected points progressively fade as multiple selections are made
ggplotly(p) |>
highlight(on="plotly_selected",off="plotly_deselect")
I suspect this is some strange interaction between the usual dimming of unselected points by plotly and the dimming of unselected points via the crosstalk selection. A workaround that seems to fix the problem is to disable the usual plotly dimming, so the only dimming of points is done via crosstalk.
# Workaround:
ggplotly(p) |>
style(unselected=list(marker=list(opacity=1))) |>
highlight(on="plotly_selected",off="plotly_deselect")
PS I'm very excited by the possibilties crosstalk offers. I had a wow moment when I realised it worked with GGally::ggpairs.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducible R example using highlight_key(), ggplot(), ggplotly(), and highlight() with plotly_selected. Repeated rectangle selections should not progressively dim unselected points, and the style(unselected=list(marker=list(opacity=1))) workaround should no longer be needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100