Weird Sankey cycles when nodes are positionned and not ordered by increasing x values
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
I had some strange looking arrows in a Sankey (Plotly v 5.5.0), involving loops. The exact same problem was raised here. After trying different things, I found out the problem occured only when using node positions, and if the nodes in a given loop are not ordered by ascending 'x' position. You may give it a try with this very basic example:
import plotly.graph_objects as go
fig = go.Figure(go.Sankey(
node = {"label": ["First node", "Last node"],
"x": [0.6, 0.2],
"y": [0.2, 0.6]},
link = {
"source": [0, 1],
"target": [1, 0],
"value": [1, 1]
}))
fig.show()
And then replacing the "x" line by:
"x": [0.2, 0.6],
This looks like a bug, which should be fixed ideally. In the meantime, I strive to first order my nodes by ascending X position, which is rather tedious, since I already have to remove nodes without links (or 0 value links) as explained in other open issues. This involves quite a bit of pre-processing unfortunately.
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
Beginnen Sie mit dem minimalen Python-Sankey-Beispiel im Issue und vergleichen Sie die beiden x-Reihenfolgen der Knoten. Verfolgen Sie den Sankey-Rendering-Pfad, um zu ermitteln, warum die umgekehrten Positionen fehlerhafte Schleifenpfeile erzeugen; die Aufgabe ist abgeschlossen, wenn beide Reihenfolgen den Zyklus korrekt rendern, ohne dass Aufrufer Knoten neu anordnen müssen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100