How do I change the color of the edges in a graph in networkx based on the weights of those edges?
The following code just gives all black edges,even though the colormap is jet!
nx.draw_networkx(g,pos=pos,with_labels=True,edge_colors=[g[a][b]['weight'] for a,b in g.edges()], width=4,edge_cmap = plt.cm.jet)
Scaling the edge weights to be between 0 and 1 doesn't change anything.
I'm not sure how the above code differs from that in a related question except that I don't use a loop for draw_networkx
because I'm not animating the graph.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…