You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm also interested in this feature, and had a look into implementing this. The main challenge is that the plotly fork of d3-sankey (https://github.com/plotly/d3-sankey) is quite old and doesn't include the nodeSort feature, so either that feature needs to be ported to the plotly fork, or recent changes from upstream need to be merged into the fork. plotly/d3-sankey-circular would also need updating.
Then you can simply call sankey.nodeSort(null) so that the order of nodes is based on the order in the input array rather than letting the layout reorder them.
Pinging here, this feature would be really useful for reproducibility. I understand we can specify x/y coordinates, but if I have to do a nontrivial layout like that, I may as well paint traces myself without using Plotly. It is a bit weird that this is supported by the underlying d3 but plotly cannot expose. This kind of issue has been open for years now...
Reacted by Uvini Ranaweera, mmoisse, John Bolt, Tristan Rey, mattgra, Janosh Riebesell and erklem
Would still be useful. It makes the use of Sankey diagrams combined to sliders rather irrelevant, as position of the nodes might change at each step...
I agree. This would be a great feature! There have been similar requests (e.g. plotly/plotly.py#960) on the python repo, and the plotly team has redirected people to this plotly.js repo for this feature.
Activity
etpinard commentedon Nov 26, 2019
@antoinerg can you confirm that the current sankey implementation does not allow sorting nodes?
antoinerg commentedon Nov 26, 2019
@etpinard I confirm we don't currently allow sorting nodes. However, it seems like underlying engines support it:
d3-sankeysupports itd3-sankey-circularoffers some kind of sorting1kastner commentedon Sep 27, 2021
It would be great to have this feature!
hohuyhoangg commentedon Aug 31, 2023
@archmoj I really need this feature.
adamreeve commentedon Jan 7, 2024
I'm also interested in this feature, and had a look into implementing this. The main challenge is that the plotly fork of d3-sankey (https://github.com/plotly/d3-sankey) is quite old and doesn't include the
nodeSortfeature, so either that feature needs to be ported to the plotly fork, or recent changes from upstream need to be merged into the fork.plotly/d3-sankey-circularwould also need updating.Then you can simply call
sankey.nodeSort(null)so that the order of nodes is based on the order in the input array rather than letting the layout reorder them.scodesido-at-proton commentedon Mar 7, 2024
Pinging here, this feature would be really useful for reproducibility. I understand we can specify x/y coordinates, but if I have to do a nontrivial layout like that, I may as well paint traces myself without using Plotly. It is a bit weird that this is supported by the underlying d3 but plotly cannot expose. This kind of issue has been open for years now...
[-]Sankey: sort nodes [/-][+]allow users to sort nodes in Sankey plot[/+]Nats1rt commentedon Feb 28, 2025
Would still be useful. It makes the use of Sankey diagrams combined to sliders rather irrelevant, as position of the nodes might change at each step...
erklem commentedon Dec 11, 2025
I agree. This would be a great feature! There have been similar requests (e.g. plotly/plotly.py#960) on the python repo, and the plotly team has redirected people to this plotly.js repo for this feature.