[英]How to customize parallel categories diagram colors with plotly ? Python edition
我正在尝试从 Plotly 执行全彩色自定义并行类别图,但我不能。 关于该主题的文档完全是空的: https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.parcats.line.colorbar.ZFC35FDC73A didnot28find28 .
3 列,1 列只有一个类别(此处为“Base”),2 列有 2 个类别(此处为“10”和“15”)
先感谢您
从此处的文档示例和 go.Sankey.link 的 output(如果您在 jupyter 中) go.Sankey.link?
您可以检查是否可以使用 color 修改每个链接的color
。
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", "B1", "B2", "C1", "C2"],
color = "blue"
),
link = dict(
source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A2, B1, ...
target = [2, 3, 3, 4, 4, 5],
value = [8, 4, 2, 8, 4, 2],
color = ["red", "green", "orange", "red", "yellow", "green"]
))])
fig.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.