积杂的Sankey带有逆向流动会产生空白图表

时间:2019-05-31 06:59:31

标签: python plotly

我创建了一个Plotly Sankey图表,其正向流很容易,但是当我尝试创建向后流时,该图会产生一个空白屏幕!在前向流中,源小于目标。当我使目标小于源时,将出现一个空白图表!在Plotly Sankey图表中是否可以向后流动?

import plotly as py

data_trace = dict(
    type='sankey',
    width = 1118,
    height = 772,
    domain = dict(
    x =  [0,1],
    y =  [0,1]
    ),
    orientation = "h",
    valueformat = ".0f",
    valuesuffix = " Peepies2",
    node = dict(
        pad = 15,
        thickness = 15,
        line = dict(
            color = "black",
            width = 0.5
            ),
   label = ['Test1', 'Test2', 'Test3', 'Test4'],
   color = ["rgba(231, 119, 180, 0.8)","rgba(155, 127, 14, 0.8)","rgba   (224, 160, 44, 0.8)"]
    ),
   link = dict(
       # This works  
       #source = [0,1,1],
       #target = [1,2,3],
       # This doesn't! Want a reverse flow from 2 back to zero
       source = [0,1,2],
       target = [1,2,0],        
       value =  [100,60,10],
       label =  ['Test1', 'Test2', 'Test3', 'Test4']
        ))


    layout =  dict(
        title = "Sankey Test",
        font = dict(
        size = 10
        ),
    )

fig = dict(data=[data_trace], layout=layout)
py.offline.plot(fig, filename = 'SandkeyNK1.html', validate=False, auto_open=True)

没有错误消息,只是一个空白屏幕

0 个答案:

没有答案