0

Is there a possibility to to change the frame color of link in a Sankey diagram? So far I have the following code:

from plotly import graph_objects as go

label = ['Start', 'Intermediate', 'End']
source = [0, 0, 1]
target = [1, 2, 2]
value = [50, 10, 5]
link_color = ["#6E0CED", "#6E0CED","#D4000D"]
node_color = ["#6E0CED", "#D4000D","#ED682C"]
link = dict(
    source = source,
    target = target, 
    value = value,
    color = link_color
)
node = dict(
    label=label,
    pad=35, 
    thickness=5,
    color = node_color,
    line = dict(color = "black", width = 0.5),
)
data = go.Sankey(link = link, node = node)

fig = go.Figure(data)
fig.update_layout(
    title_text = "Title",
    font =dict(size = 12, color = 'white'),
    paper_bgcolor = "#000000"
)
fig.show()

resulting in the following plot:

The two purple flows are quite hard to distinguish, so I'd like to add a thin white frame on the top and bottom of each link to make them better distinguishable. So far I could not find any code so change only the frame color. I know that I could change one of the link's colors but I'd like to keep all links from one node the same color to reduce complexity when the diagram becomes bigger.

TiTo
  • 833
  • 2
  • 7
  • 28

0 Answers0