각 가장자리를 개별적으로 지정할 수도 있고 그룹화를 계산하는 기능이있는 경우 그룹으로 정의 할 수도 있습니다. 그런 다음 draw_network_edges
에 여러 번 호출 할 수 있습니다.
다음은 가장자리 가중치를 그대로 사용하는 임의의 그래프의 예입니다. 먼저 가장자리 두께를 정의하고 두 번째로 데이터를 색상으로 사용합니다. 당신에게 같은 것을 제공
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
n = 15; m = 40
# select some edge destinations
L = np.random.choice(xrange(n), 2*m)
# and suppose that each edge has a weight
weights = 0.5 + 5 * np.random.rand(m)
# create a graph object, add n nodes to it, and the edges
G = nx.DiGraph()
G.add_nodes_from(xrange(n))
for i, (fr, to) in enumerate(zip(L[1::2], L[::2])):
G.add_edge(fr, to, weight=weights[i])
# use one of the edge properties to control line thickness
edgewidth = [ d['weight'] for (u,v,d) in G.edges(data=True)]
# layout
pos = nx.spring_layout(G, iterations=50)
#pos = nx.random_layout(G)
# rendering
plt.figure(1)
plt.subplot(211); plt.axis('off')
nx.draw_networkx_nodes(G, pos)
nx.draw_networkx_edges(G, pos, width=edgewidth,)
plt.subplot(212); plt.axis('off')
# rendering
nx.draw_networkx_nodes(G, pos)
nx.draw_networkx_edges(G, pos, edge_color=edgewidth)
plt.show()
: 
은 분명히 당신이 당신의 응용 프로그램에 적합한 edgewidth 값의 목록을 조립하는 더 복잡한 기능을 사용할 수 있습니다 (예 : 비닝 값이나 다른 속성의 제품) 게다가.
범례 추가는 어떻습니까? – FaCoffee