Plotly.py: How do I set default order of my sankey diagram?

Created on 7 Mar 2018  Â·  9Comments  Â·  Source: plotly/plotly.py

Whenever I display my sankey diagrm(sankey chart) with python plotly,
the order of nodes change depending on some unknown rules.
How do i fix the order of the nodes?

Most helpful comment

Hi there,
It is not possible to set default ordering at this time. You can see the list of available sankey attributes here: https://plot.ly/python/reference/#sankey
The attributes of the sankey chart are determined in our plotly.js repo (plotly's core graphing library).
We ask users to reserve issues in this repo for bugs with Plotly's python api, if you have additional plotting questions feel free to post in our community forum: https://community.plot.ly/

All 9 comments

Hi there,
It is not possible to set default ordering at this time. You can see the list of available sankey attributes here: https://plot.ly/python/reference/#sankey
The attributes of the sankey chart are determined in our plotly.js repo (plotly's core graphing library).
We ask users to reserve issues in this repo for bugs with Plotly's python api, if you have additional plotting questions feel free to post in our community forum: https://community.plot.ly/

@cldougl could you shed some light into the logic to determine the ordering of the nodes? How is it decided which ones are rendered on top?

This is done automatically by plotly.js. Custom ordering is currently being worked on in https://github.com/plotly/plotly.js/pull/3583.

Hi! Is this still not possible? It seems like defining node order would be a great feature (I'm currently trying to make my sankey more static). I've used the arrangement = 'fixed' attribute to help, but I'd now like to define a fixed node order if possible.

I don't think it's possible yet, unfortunately.

On Tue, Jul 30, 2019 at 1:54 PM Austen Sharpe notifications@github.com
wrote:

Hi! Is this still not possible? It seems like defining node order would be
a great feature (I'm currently trying to make my sankey more static)

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/plotly/plotly.py/issues/960?email_source=notifications&email_token=AA5KHZ7GYX53Z73DFVM3LR3QCB563A5CNFSM4EUAKDB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3EY2EA#issuecomment-516525328,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA5KHZ3HLGWOC2457LMAHQTQCB563ANCNFSM4EUAKDBQ
.

I don't know if it's still relevant, but you can actually drag and drop them on the UI. Far from perfect, but it will save you if you have a presentation to make quickly ;)

Any updates? I was trying to manually define the positions of the nodes with x and y arguments of node. For both x and y I use values between 1 and 0 (these not included). Seems to work ok until I change the value of the orientation to vertical, i.e. orientation='v'.

How does these normalized values x and y actually work? Thanks

I have to agree this is very disappointing as half the value of a Sankey diagram is in its presentation and being able to eyeball trends. For example, if the first level is by Year, a random order is not useful for deciphering patterns.

@thenineteen et al - As mentioned above, can you please create a new issue in the plotly.js repo and comment when you do so? That’s where the rendering work is done for plotly.py. A new issue in the proper repository will get more attention than one that’s been closed for 2.5 years :) https://github.com/plotly/plotly.js/issues

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jisaacso picture jisaacso  Â·  4Comments

fcollonval picture fcollonval  Â·  3Comments

tssweeney picture tssweeney  Â·  4Comments

vlizanae picture vlizanae  Â·  4Comments

dhirschfeld picture dhirschfeld  Â·  4Comments