Skip to content Skip to sidebar Skip to footer

Colormap Not Working In Networkx

I am trying to make colored graphs. I keep running into odd behavior. I cannot get the colormap to assign colors automatically to the nodes. All nodes I try to do this with wind u

Solution 1:

As this is old and Lack answered the question in the comments I am copying his answer here and accepting:

I can't run your code without errors (TypeError: 'complex' object has no attribute '__getitem__' on j[t]) but it's the same problem as your other question which I answered (stackoverflow.com/questions/27831022/…). Because you pass only one node at a time to draw_networkx_nodes, it "normalizes" the length-1 array of colors without regard to the other nodes. You should get rid of the loop and pass all the nodes in one array to draw_networkx_nodes.

Post a Comment for "Colormap Not Working In Networkx"