So I am trying to plot a sankey and it should be showing 13 source nodes going to 4 different target nodes, but I have no idea why it is not showing the 13 and is only showing 6? Here is my code and output. It is successfully plotting all 4 of the target nodes, but only 6 of the source nodes and a really weird order too. It plots the “test” (the first node), “test3” (4th node), “test7”, “test10”, “test12”, “test8”.
import plotly.graph_objects as go
source = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
target = [13, 13, 13, 14, 14, 14, 14, 15, 16, 16, 16, 16, 16]
value = [1.5731754916099199, 0.0, -0.6622546030040232, 0.1803752820589049, -0.12705291484645911, -0.11239581604114621, -0.33000230488318316, 0.10184310050452802, 0.23013722041176082, -0.052664676881438124, 85.1250672340013, -0.006987341636945739, 11.9843590360198]
labels = ["test", 'test1', 'test2', 'test3', 'test4', 'test5', 'test6', 'test7', 'test8', 'test9', 'test10', 'test11', 'test12', 'TARGET1', 'TARGET2', 'TARGET3', 'TARGET4']
link = dict(source=source, target=target, value=value)
node = dict(label=labels, pad=35, thickness=10)
data = go.Sankey( textfont=dict(color="rgba(0,0,0,0)", size=1), link=link, node=node)
fig = go.Figure(data)
fig.update_layout(
hovermode = 'x',
title="Sankey",
font=dict(size=8, color='white'),
paper_bgcolor='#51504f'
)
fig.show()