Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (661 Bytes)

1
"""
2
=============
3
Circular Tree
4
=============
5

6
This
7
"""
8
import matplotlib.pyplot as plt
9
import networkx as nx
10

    
11
try:
12
    import pygraphviz
13
    from networkx.drawing.nx_agraph import graphviz_layout
14
except ImportError:
15
    try:
16
        import pydot
17
        from networkx.drawing.nx_pydot import graphviz_layout
18
    except ImportError:
19
        raise ImportError("This example needs Graphviz and either "
20
                          "PyGraphviz or pydot")
21

    
22
G = nx.balanced_tree(3, 5)
23
pos = graphviz_layout(G, prog='twopi', args='')
24
plt.figure(figsize=(8, 8))
25
nx.draw(G, pos, node_size=20, alpha=0.5, node_color="blue", with_labels=False)
26
plt.axis('equal')
27
plt.show()