KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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.
Tags (comma-separated)
Save Edits
Cancel