How do I customize the display of edge labels in networkx?
<p>I create a graph with edge attributions (say <code>r</code>, such as, <code>r=23</code>).</p>

<p>How do display edge labels only with the values, <code>23</code> instead of <code>{'r':'23'}</code>.</p>

<p><a href="https://i.stack.imgur.com/SxlQK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SxlQK.png" alt="enter image description here"></a></p>

<p>Related source codes are below:</p>

<pre><code># build a graph
G.add_edge(u, v, r=value)

# plot the graph
pos = nx.spring_layout(G, scale=2)

nx.draw(G, pos)

edge_labels = nx.get_edge_attributes(G,'r')
nx.draw_networkx_edge_labels(G, pos, labels = edge_labels)

plt.savefig(out_file)
</code></pre>