plotly / plotly/plotly.R

Dimming of unselected points by both plotly and crosstalk makes points progressively fade away.

Offen
#2,189 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit dem reproduzierbaren R-Beispiel, das highlight_key(), ggplot(), ggplotly() und highlight() mit plotly_selected verwendet. Wiederholte Rechteckauswahlen sollten nicht dazu führen, dass nicht ausgewählte Punkte zunehmend abgedunkelt werden, und der Workaround style(unselected=list(marker=list(opacity=1))) sollte nicht mehr erforderlich sein.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.