我非常想做一个类似链接中的例子:
我在Python中很难做到这一点,因为它创建了我不想要的多个链接figures。我的剧本是:
import plotly.graph_objects as go
fig = go.Figure(data=[go.Sankey(
node = dict(
pad = 15,
thickness = 20,
line = dict(color = "black", width = 0.5),
label = ["A1", "A2", "A3", "A4", "A5", "A1", "A2", "A3", "A4", "A5"],
color = "blue"
),
link = dict(
source = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], # indices correspond to labels, eg A1, A2, A1, B1, ...
target = [2, 3, 4, 1, 5, 0, 9, 6, 7, 8],
value = [8, 4, 2, 8, 4, 2,1, 0, 2, 3]
))])
fig.update_layout(title_text="Basic Sankey Diagram", font_size=10)
fig.show()
有人能帮我吗
由于您使用的是官方网站上的Sankey对话框,因此我将对其进行编辑,以显示ABs之间的数据结构。简单地说,源是A,目标是B,其余的是它的迭代。据我所知,问题中链接中显示的其他标签在plotly的sankey对话框中不可用。你必须对标签有创意。我将添加一个基于文本的解释我在做什么
相关问题 更多 >
编程相关推荐