我需要更改networkx上有向图的默认箭头样式。我读过一些关于matplotlib.patches.ArrowStyle的文章,但我对python的编码太新了,甚至更新,所以我一点也不懂。我当前的代码是:
G=nx.DiGraph()
n=len(C)
print(n)
for i in range(n):
G.add_node(i)
for i in nodos_usuarios:
for j in nodos_cri:
if Y[i,j].x==1:
G.add_edge(i,j)
pos = nx.circular_layout(G)
x=G.node()
y=G.edges()
elist = edges
print(x)
print("")
print(y)
print("")
nx.draw_networkx_nodes(G, pos, label="ciudades",size=0.1)
nx.draw_networkx_labels(G, pos)
nx.draw_networkx_edges(G, pos, edgelist=elist, edge_color='green', width=3, label="S")
plt.legend(fontsize = 'medium')
plt.axes().set_aspect('equal')
plt.savefig("Red.png")
plt.show()Y是与图G相关的矩阵。我当前的输出是:Ugly graph - Ugly arrow
因此,我需要帮助将这种箭头样式更改为我们都知道的经典箭头。有没有人可以帮我更轻松地做这件事?
https://stackoverflow.com/questions/51413834
复制相似问题