Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / examples / drawing / plot_node_colormap.py @ 5cef0f13

History | View | Annotate | Download (409 Bytes)

1
#!/usr/bin/env python
2
"""
3
=============
4
Node Colormap
5
=============
6

7
Draw a graph with matplotlib, color by degree.
8
You must have matplotlib for this to work.
9
"""
10
# Author: Aric Hagberg (hagberg@lanl.gov)
11

    
12
import matplotlib.pyplot as plt
13
import networkx as nx
14

    
15
G = nx.cycle_graph(24)
16
pos = nx.spring_layout(G, iterations=200)
17
nx.draw(G, pos, node_color=range(24), node_size=800, cmap=plt.cm.Blues)
18
plt.show()