[英]How to customize parallel categories diagram colors with plotly ? Python edition
I'm trying to perform a full colored custom parallel categories diagram from Plotly but I can't.我正在尝试从 Plotly 执行全彩色自定义并行类别图,但我不能。 The documentation about the subject is utterly empty: https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.parcats.line.colorbar.html and I did not find a example.关于该主题的文档完全是空的: https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.parcats.line.colorbar.ZFC35FDC73A didnot28find28 .
And this is what I want (thank you Paint)这就是我想要的(谢谢Paint)
3 Columns, 1 with only one categorie ('Base' here), 2 with 2 categories ('10' and '15' here) 3 列,1 列只有一个类别(此处为“Base”),2 列有 2 个类别(此处为“10”和“15”)
Thank you in advance先感谢您
From examples in documentations here and the output (if you are in jupyter) of go.Sankey.link?
从此处的文档示例和 go.Sankey.link 的 output(如果您在 jupyter 中) go.Sankey.link?
you could check that you can modify the color of every link using color
.您可以检查是否可以使用 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.