Weird Sankey cycles when nodes are positionned and not ordered by increasing x values
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 18.8k
- Forks
- 2.8k
- Merge medio
- 16 h 26 min
- PR fusionados (30 d)
- 21
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo mínimo de Sankey en Python del issue y compara los dos órdenes x de los nodos. Sigue la ruta de renderizado de Sankey para identificar por qué las posiciones invertidas generan flechas de bucle defectuosas; el trabajo estará terminado cuando ambos órdenes rendericen el ciclo correctamente sin requerir que los llamadores reordenen los nodos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100