draw_networkx_edge_labels(G, pos, edge_labels=None, label_pos=0.5, font_size=10, font_color='k', font_family='sans-serif', font_weight='normal', alpha=None, bbox=None, horizontalalignment='center', verticalalignment='center', ax=None, rotate=True, clip_on=True)
A networkx graph
A dictionary with nodes as keys and positions as values. Positions should be sequences of length 2.
Edge labels in a dictionary of labels keyed by edge two-tuple. Only labels for the keys in the dictionary are drawn.
Position of edge label along edge (0=head, 0.5=center, 1=tail)
Font size for text labels
Font color string
Font weight
Font family
The text transparency
Specify text box properties (e.g. shape, color etc.) for edge labels. Default is {boxstyle='round', ec=(1.0, 1.0, 1.0), fc=(1.0, 1.0, 1.0)}.
Horizontal alignment {'center', 'right', 'left'}
Vertical alignment {'center', 'top', 'bottom', 'baseline', 'center_baseline'}
Draw the graph in the specified Matplotlib axes.
Rotate edge labels to lie parallel to edges
Turn on clipping of edge labels at axis boundaries
:None:None:`dict`
of labels keyed by edge
Draw edge labels.
>>> G = nx.dodecahedral_graph()
... edge_labels = nx.draw_networkx_edge_labels(G, pos=nx.spring_layout(G))
Also see the NetworkX drawing examples at https://networkx.org/documentation/latest/auto_examples/index.html
See :The following pages refer to to this document either explicitly or contain code examples using this.
networkx.drawing.nx_pylab.draw_networkx
networkx.drawing.nx_pylab.draw
networkx.drawing.nx_pylab.draw_networkx_labels
networkx.drawing.nx_pylab.draw_networkx_edge_labels
networkx.drawing.nx_pylab.draw_networkx_edges
networkx.drawing.nx_pylab.draw_networkx_nodes
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them