NetworkX

Previous topic

draw_networkx_edges

Next topic

draw_networkx_edge_labels

draw_networkx_labels

draw_networkx_labels(G, pos, labels=None, font_size=12, font_color='k', font_family='sans-serif', font_weight='normal', alpha=1.0, ax=None, **kwds)[source]

Draw node labels on the graph G.

Parameters :

G : graph

A networkx graph

pos : dictionary, optional

A dictionary with nodes as keys and positions as values. If not specified a spring layout positioning will be computed. See networkx.layout for functions that compute node positions.

font_size : int

Font size for text labels (default=12)

font_color : string

Font color string (default=’k’ black)

font_family : string

Font family (default=’sans-serif’)

font_weight : string

Font weight (default=’normal’)

alpha : float

The text transparency (default=1.0)

ax : Matplotlib Axes object, optional

Draw the graph in the specified Matplotlib axes.

Examples

>>> G=nx.dodecahedral_graph()
>>> labels=nx.draw_networkx_labels(G,pos=nx.spring_layout(G))

Also see the NetworkX drawing examples at http://networkx.lanl.gov/gallery.html