plotly / plotly/plotly.R

For a categorical colour aesthetic, there appears to be no documented way to use selectedpoints to select individual points.

Offen
#2,459 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

The following example highlights the first point from each colour group (the first "a" point and the first "b" point):

library(plotly)

d <- data.frame(x = 1:4, c = c("a", "a", "b", "b"))

plot_ly(d) |>
  add_trace(x=~x, y = ~x, color = ~c, type = "scatter", selectedpoints = list(0))

From the plot_ly() documentation, it appears that this code implicitly creates multiple traces, one for each colour, so this behaviour makes sense on this level (even if it's surprising). However, there appears to be no documented way to access individual traces. I've tried a number of permutations

In my opinion, if the code is going to transparently create multiple traces like that, it should also transparently map selectedpoints provided by the user (ideally as 1-based indexes or logical vectors, for consistency with R) to their positions within each trace.

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

Beginne mit der Dokumentation zu plot_ly() und dem Beispiel für kategoriale Farben, um nachzuverfolgen, wie colour separate traces erzeugt und wie selectedpoints weitergereicht wird. Als abgeschlossen gilt, wenn eine dokumentierte, konsistente Möglichkeit bereitgestellt wird, Punkte innerhalb jedes generierten traces auszuwählen, mit Abdeckung für das gezeigte Beispiel und das vorgeschlagene R-style-Indexierungsverhalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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