Hi,
I am trying to plot a graph and color nodes in a loop. So far, the for-loop I am using can color them. But, I am able to color them using a single color. I want to color the nodes differently for each iteration of the for-loop. How do I do that?
My code so far:
···
============================================
nx.draw(G,pos, node_color='w', edge_color='k',
width=0.5,with_labels=True,alpha=0.8)
time.sleep(1)
# Now, begin updating by coloring nodes and edges
for i,nlist in enumerate(MIS_levels):
# update-color each level nodes
nx.draw_networkx_nodes(G,pos,nodelist=nlist,
node_color='b',node_size=200,alpha=0.8)
time.sleep(1)
if i < len(elist):
nx.draw_networkx_edges(G,pos, edgelist=elist[i],edge_color='r',
width=2,with_labels=True,alpha=0.8)
plt.plot()
time.sleep(1)
========================================================
The above code colors the nodes blue and the edges r. I want to options:
1 — For each iteration, I want the nodes to be colored in diminishing shade (like Red_r).
2 — For each iteration, I want a separate coloring of the nodes.
Any ideas, suggestions are very much appreicated.
Thanks,
Sri.