如何为这个桑基图的节点和链接添加自动匹配的颜色?

问题描述 投票:0回答:0

这是我得到的 sankey plot 的代码:

fig = go.Figure(data = [go.Sankey(
    node = dict(
        pad = 15,
        thickness = 20, 
        line = dict (color = 'black', width = 0.5),
        label = unique_source_target_ses,
    ), 
    
    link = dict(
        source = links_dict_ses['source'],
        target = links_dict_ses['target'],
        value = links_dict_ses['value'],
    )
)]

)

我用源、目标和值定义了 links_dict_ses。现在我想为链接和节点添加颜色,以便它们匹配以便更好地遵循桑基图的流程。

如何为链接添加颜色,使其与节点中的颜色相匹配?

python pandas colors sankey-diagram
© www.soinside.com 2019 - 2024. All rights reserved.