[英]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.