Hi teams,
I am doing Sankey diagram following this tutorial, Sankey Diagram | Python | Plotly
When I plot the fig, the browser runs slowly, and shows out of memory.
My data is not large, the source, target, value are lists with length 173. node_lst_oder(label) length is only 16.
All elements are integer, eg. source= [0, 1, 2, 3, …], target =[1, 2, 3, 4,…], value=[10,20,30,40,…]
I am using python 3.7.6, plotly 4.14.3, working on spyder IDE.
Thanks for help in advanced
Here is my code,
import plotly.graph_objects as go
from plotly.offline import plot
fig = go.Figure(go.Sankey(
arrangement = "snap",
node = {
"label": node_lst_oder,
'pad':10}, # 10 Pixels
link = {
"source": source,
"target": target,
"value": value_plot}))
plot(fig, auto_open=True)
for label, it would be like:
node_lst_order=['station 1', 'station 2', ...., 'station16']
start=[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
target=[0, 1, 10, 11, 2, 5, 7, 9, 0, 1, 12, 14, 2, 3, 5, 7, 9, 0, 10, 11, 14, 15, 2, 3, 5, 6, 7, 8, 9, 0, 11, 12, 14, 15, 2, 3, 7, 8, 9, 11, 14, 2, 3, 5, 7, 8, 9, 10, 11, 14, 15, 2, 7, 9, 10, 11, 13, 14, 15, 2, 3, 6, 7, 9, 10, 11, 14, 15, 2, 3, 6, 7, 9, 0, 1, 10, 11, 12, 13, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 10, 11, 12, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 7, 0, 1, 10, 12, 13, 2, 3, 4, 5, 6, 7, 8, 0, 10, 12, 14, 15, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 10, 11, 12, 13, 14, 15, 2, 3, 5, 6, 7, 8, 9, 1, 11, 15, 2, 3, 5, 6, 7, 8, 9, 0, 1, 10, 11, 12, 13, 14, 15, 2, 3, 5, 6, 7, 8, 9]
value_plot=[[5, 1, 1, 3, 4, 3, 11, 1, 1, 9, 1, 2, 1, 2, 2, 34, 2, 1, 5, 1, 4, 2, 8, 3, 2, 2, 12, 3, 7, 2, 314, 1, 9, 3, 9, 9, 363, 19, 11, 7, 2, 2, 2, 5, 10, 2, 2, 3, 1, 1, 2, 4, 12, 1, 6, 11, 3, 13, 1, 16, 8, 2, 89, 12, 1, 4, 1, 4, 5, 1, 2, 59, 2, 1, 2, 10, 13, 4, 2, 10, 4, 57, 41, 1, 3, 8, 150, 6, 22, 3, 5, 5, 10, 3, 4, 2, 37, 109, 1, 37, 4, 125, 6, 13, 2, 11, 21, 1, 3, 1, 1, 2, 1, 9, 38, 21, 60, 2, 4, 15, 1, 6, 1, 5, 1, 4, 4, 1, 1, 4, 44, 2, 5, 10, 34, 7, 348, 19, 16, 96, 54, 149, 129, 4, 48, 3101, 52, 89, 1, 19, 1, 9, 5, 17, 2, 50, 26, 4, 1, 1, 5, 9, 1, 2, 14, 5, 20, 11, 2, 5, 91, 4, 11]