Package networkx :: Package drawing :: Module nx_pylab

[frames | no frames]

## Module networkx.drawing.nx_pylab

Draw networks with matplotlib/pylab.

References:
  - matplotlib: http://matplotlib.sourceforge.net/

Function Summary
| ``draw`(G, **kwargs)` Draw networkx graph using spring layout.
| ``draw_circular`(G, **kwargs)` Draw networkx graph in circular layout
| ``draw_nx`(G, node_pos, **kwargs)` Draw networkx graph with nodes at node_pos.
| ``draw_nxpydot`(G, **kwds)` Draw networkx graph using pydot and graphviz layout.
| ``draw_nxpydot_nolabels`(G, **kwargs)` Draw networkx graph without labels in textbook style.
| ``draw_pydot`(P, **kwargs)` Draw pydot graph P with matplotlib.
| ``draw_pydot_subgraph`(ax, P, **kwds)` Draw a pydot network P that has nested subgraphs.
| ``draw_random`(G, **kwargs)` Draw networkx graph with random layout.
| ``draw_shell`(G, **kwargs)` Draw networkx graph with shell layout
| ``draw_spectral`(G, **kwargs)` Draw networkx graph with spectral layout.
| ``draw_spring`(G, **kwargs)` Draw networkx graph with spring layout
| ``drawg`(G, **kwargs)` Draw networkx graph using spring layout
| ``mpl_network`(ax, node_pos, edge_pos, node_size, node_color, node_marker, node_labels, fonts, edge_color, edge_width, cmap, norm, vmin, vmax, alpha, digraph)` Draw network with matplotlib using node positions=node_pos and edge positions=edge_pos.

Variable Summary
`str` | `__author__` = `'Aric Hagberg (hagberg@lanl.gov)'`
`str` | `__credits__` = `''`
`str` | `__date__` = `'$Date: 2005-06-15 11:29:39 -0600 (Wed, 15 Ju...`
`str` | `__revision__` = `'$Revision: 1035 $'`

Function Details

### draw(G, **kwargs)

Draw networkx graph using spring layout. NB: pylab.draw() has been renamed to pylab.redraw() so use redraw() from pylab interface.

### draw_circular(G, **kwargs)

Draw networkx graph in circular layout

### draw_nx(G, node_pos, **kwargs)

Draw networkx graph with nodes at node_pos. See layout.py for functions that compute node positions.

node_pos is a dictionary keyed by vertex with a two-tuple of x-y positions as the value.

Use kwarg of node_color with a dictionary keyed by vertex with a floating point number as a value.

Use kwarg of node_size with a dictionary keyed by vertex with a floating point number as a value.

### draw_nxpydot(G, **kwds)

Draw networkx graph using pydot and graphviz layout.

    >>> G=barbell_graph(5,10)
    >>> d=G.degree(with_labels=True)
    >>> draw_nxpydot(G)
    >>> draw_nxpydot(G,node_color=d,cmap=cm.pink)
    >>> draw_nxpydot(G,prog='neato')

Can use prog= "neato", "dot", "circo", "twopi", or "fdp"

### draw_nxpydot_nolabels(G, **kwargs)

Draw networkx graph without labels in textbook style.

node_color is black, unless specified in kwargs (with node_color= a dictionary that maps each key=node to a floating point number.) e.g. >>> G=star_graph(10) >>> d=G.degree(with_labels=True) >>> draw_nxpydot_nolabels(G) >>> draw_nxpydot_nolabels(G,node_color=d,cmap=cm.pink) >>> draw_nxpydot_nolabels(G,prog='neato')

Can use prog= "neato", "dot", "circo", "twopi", or "fdp"

### draw_pydot(P, **kwargs)

Draw pydot graph P with matplotlib. The pydot graph must have position information in graphviz dot format.

### draw_pydot_subgraph(ax, P, **kwds)

Draw a pydot network P that has nested subgraphs.

### draw_random(G, **kwargs)

Draw networkx graph with random layout.

### draw_shell(G, **kwargs)

Draw networkx graph with shell layout

### draw_spectral(G, **kwargs)

Draw networkx graph with spectral layout.

### draw_spring(G, **kwargs)

Draw networkx graph with spring layout

### drawg(G, **kwargs)

Draw networkx graph using spring layout

### mpl_network(ax, node_pos, edge_pos, node_size=300, node_color='r', node_marker='o', node_labels=True, fonts={}, edge_color='k', edge_width=1.0, cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, digraph=False)

Draw network with matplotlib using node positions=node_pos and edge positions=edge_pos.

Steals heavily from matplotlib.axes.scatter.

Variable Details

### __author__

  Type:
    `str`
  Value:

        'Aric Hagberg (hagberg@lanl.gov)'

### __credits__

  Type:
    `str`
  Value:

        ''

### __date__

  Type:
    `str`
  Value:

        '$Date: 2005-06-15 11:29:39 -0600 (Wed, 15 Jun 2005) $'

### __revision__

  Type:
    `str`
  Value:

        '$Revision: 1035 $'

Generated by Epydoc 2.1 on Sun Aug 21 08:06:58 2005 | http://epydoc.sf.net