Looking for any pointers or examples on fine control of link order in sankey diagrams.
I've followed the examples from the plotly page. I can see that there is some ability to control link order with the organization of lists, but there seems to be an over-riding sort by node index that changes the exact link list order.
It looks like "domain" might do what i want, but haven't been able to get that working from the description in the documentation (and haven't found any working examples of its implementation).
An example of final output i would like is below. The vertical position of entry to each node is consistent with the exit position. i.e. following any trace along the horizontal axis gives its identity.
I'm looking to make plots with 4 or more columns of nodes.
I'd like to run this directly in python.
Edit: I have returned to this issue and will include some toy code below to get this issue worked out.
The output I want from the following code is to have the links flow to from 1->3->5 and from 0->3->6. This gives the visual representation that there is a sample that is in categories 0,3,6 and one that is in categories 1,3,5. Essentially the entry points to node 3 need to be flipped. How can i get explicit control of link order?
import plotly.graph_objects as go
fig = go.Figure(go.Sankey(
arrangement='snap',
node=dict(
label=["0", "1", "2", "3", "4", "5","6"],
align='left'
),
link=dict(
arrowlen=15,
source=[0, 0, 0, 1, 1, 1, 2, 3, 3, 4],
target=[2, 3, 4, 2, 3, 4, 5, 5, 6, 6],
value= [1, 1, 1, 1, 1, 1, 2, 1, 1, 2]
)
))
fig.show()
# changing the node order in lists has no effect:
fig = go.Figure(go.Sankey(
arrangement='snap',
node=dict(
label=["0", "1", "2", "3", "4", "5","6"],
align='left'
),
link=dict(
arrowlen=15,
source=[1, 0, 0, 1, 0, 1, 2, 3, 3, 4],
target=[3, 2, 4, 2, 3, 4, 5, 5, 6, 6],
value= [1, 1, 1, 1, 1, 1, 2, 1, 1, 2]
)
))
fig.show()

