NetworkX

Previous topic

networkx.draw

Next topic

networkx.draw_networkx_nodes

Quick search

networkx.draw_networkx

draw_networkx(G, pos, with_labels=True, **kwds)

Draw the graph G with given node positions pos

Usage:

>>> from networkx import *
>>> import pylab as P
>>> ax=P.subplot(111)
>>> G=dodecahedral_graph()
>>> pos=spring_layout(G)
>>> draw_networkx(G,pos,ax=ax)

This is same as ‘draw’ but the node positions must be specified in the variable pos. pos is a dictionary keyed by vertex with a two-tuple of x-y positions as the value. See networkx.layout for functions that compute node positions.

An optional matplotlib axis can be provided through the optional keyword ax.

with_labels contols text labeling of the nodes

Also see:

draw_networkx_nodes() draw_networkx_edges() draw_networkx_labels()