I want to get the new positions for the nodes in the Sankey diagram after I have moved them. The diagram is set to ‘freeform’, but after I have moved the nodes I then try to get the new positions of the nodes (x,y) from the Figure. However, I only gets the old coordinates. Do anyone know how to get the new positions?
Initial plotting
Nodes = {‘label’: [“A”, “B”], ‘pad’: 1, ‘x’: [0, 0], ‘y’: [0, 0]}
links = {‘color’: ‘rgba(180,180,200, 0.8)’, ‘source’: [0, 1], ‘target’: [1, 0], ‘value’: [20, 40]}
Figure = go.Figure()
Sankey = go.Sankey(
arrangement = “freeform”,
node = Nodes,
link = links )
Figure.add_trace( Sankey)
Figure.show()
After moving the nodes I try to get their new positions (unsuccessfully, get the original positions). This is done by having a button in Dash that runs the code below.
outFile = open(“out.txt”, mode = ‘w’)
outFile.write(str(Sankey))
outFile.close()