@empet Thanks a lot for those answers. I was wondering giving different colours for each edge based on their weight.
I able plot edges with different width based on their frequency and now I want to try with different colour based on their weight (in my case Frequency).
Here my code:
def make_edge(x, y, text, width):
return go.Scatter(x = x,
y = y,
line = dict(width = width,
color = 'cornflowerblue'),
hoverinfo = 'text',
text = ([text]),
mode = 'lines')
# For each edge, make an edge_trace, append to list
edge_trace = []
for edge in graph.edges():
if graph.edges()[edge]['Frequency'] > 0:
char_1 = edge[0]
char_2 = edge[1]
x0, y0 = pos[char_1]
x1, y1 = pos[char_2]
text = char_1 + '--' + char_2 + ': ' + str(graph.edges()[edge]['Frequency'])
trace = make_edge([x0, x1, None], [y0, y1, None], text,
0.1*graph.edges()[edge]['Frequency']**1.75)
edge_trace.append(trace)
Frequency is my weight.