How do I draw non-overlapping edge labels in networkx?
<p>How do I draw non-overlapping edge labels in networkx? Using the option <code>scale</code> looks better but the edge labels are still overlapping, for instance,</p>

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

<p>The 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=3)

nx.draw(G, pos)

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

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