Fix plotly#5381: wrong x/y positions in Sankey with isolated nodes by FredericoMendes10 · Pull Request #5548 · plotly/plotly.py

@FredericoMendes10

In Sankey diagrams with arrangement='fixed', Plotly.js builds an
internal node array excluding isolated nodes (nodes not referenced
by any valid link). The fixed-arrangement loop maps position array
indices directly to this internal array, assuming a 1:1 correspondence.
When isolated nodes appear before connected nodes in the original
array, positions shift and are applied to the wrong nodes.

Fix: in plotly/io/_kaleido.py, reorder per-node arrays before
rendering so that isolated nodes appear last. This aligns the
Plotly.js internal array with the x/y position arrays for all
connected nodes.