Scatter points at wrong coordinates when combining multicategory axis and colour
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- R
- Sterne
- 2.7k
- Forks
- 641
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi,
When combining a multicategory axis and colour coding in a scatter plot, the mapping of the points seem to go wrong.
In p2 in the example below, the points appear at coordinates that are not in the data.
The problem can be resolved by first ordering the data (p4).
library(plotly)
d <- data.frame(
l1 = letters[11:15],
l2 = c('a', 'a', 'a', 'a', 'b'),
y = 1:10,
col = LETTERS[11:15],
stringsAsFactors = F
)
p1 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
# color = ~col,
type = 'scatter',
mode = 'markers'
)
p2 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
color = ~col,
type = 'scatter',
mode = 'markers'
)
d <- d[order(d$l1), ]
p3 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
# color = ~col,
type = 'scatter',
mode = 'markers'
)
p4 <- plot_ly(
data = d,
x = list(~l2, ~l1),
y = ~y,
color = ~col,
type = 'scatter',
mode = 'markers'
)
subplot(p1, p2, p3, p4, nrows = 2, margin = .07) %>%
layout(annotations = list(
list(x = 0.1 , y = 1.05, text = "unordered/uncolored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.9 , y = 1.05, text = "unordered/colored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.1 , y = .45, text = "ordered/uncolored", showarrow = F, xref='paper', yref='paper'),
list(x = 0.9 , y = .45, text = "ordered/colored", showarrow = F, xref='paper', yref='paper')
)
)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Führe zunächst das bereitgestellte reproduzierbare R-Beispiel aus und vergleiche das ungeordnete/farbige Streudiagramm mit den anderen Panels. Verfolge die Verarbeitung von Streudiagrammen für Achsen mit mehreren Kategorien in Kombination mit Farbe; abgeschlossen ist die Aufgabe, wenn die Punkte an den Koordinaten der Eingabedaten bleiben, ohne dass zuvor eine Sortierung erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- r
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100