title: How can i add color label of each edge in networkx in python
body: <p><a href="https://i.stack.imgur.com/q60kS.png" rel="nofollow noreferrer">My networkx graph</a></p>
  
  <p>In my directed networkx graph , i have drawn edges color based on weight. I am able to add them as labels in my graph but it is appearing twice. How can i add edges label with different color only once along with directions</p>
  
  <pre><code>`elarge=[(u,v) for (u,v,d) in G.edges(data=True) if d['weight'] &gt;0.10]
  emed=[(u,v) for (u,v,d) in G.edges(data=True) if d['weight'] &gt;0.05 and d['weight'] &lt;0.10]
  esmall=[(u,v) for (u,v,d) in G.edges(data=True) if d['weight'] &lt;0.05]
  
  # red_patch = mpatches.Patch(color='red', label= "Probablity &lt; 0.05")
  # plt.legend(handles=[red_patch])
  
  # blue_patch = mpatches.Patch(color='blue', label='Probablity &gt; 0.10')
  # plt.legend(handles=[blue_patch])
  
  # green_patch = mpatches.Patch(color='green',label='Probablity &gt; 0.15 and Probablity &lt; 0.10')
  # plt.legend(handles=[green_patch])
  
  
  pos=nx.spring_layout(G) # positions for all nodes
  edge_labels = nx.get_edge_attributes(G,'weight')
  
  # nodes
  nx.draw_networkx_nodes(G,pos,node_size=4000,node_color= "grey")
  
  # edges
  
  nx.draw_networkx_edges(G,pos,edgelist=elarge,
                      width=2,alpha = 0.6,edge_color = "b",label = "Probablity &gt; 0.10",arrows=True)
  nx.draw_networkx_edges(G,pos,edgelist=esmall,
                      width=3,alpha=0.6,edge_color='r',label = "Probablity &lt; 0.05",arrows=True)
  nx.draw_networkx_edges(G,pos,edgelist=emed,
                      width=3,alpha=0.6,edge_color='g',label = "'Probablity &gt; 0.15 and Probablity &lt; 0.10'",arrows=True)
  
  # labels
  nx.draw_networkx_edge_labels(G, pos, labels = edge_labels,arrows=False)
  nx.draw_networkx_labels(G,pos,labels1,font_size=12,font_family='sans-serif')
  plt.legend(numpoints = 1)
  plt.axis('on')
  plt.show()
  </code></pre>