我在python 2.7上使用Networkx来表示和模拟项目中的财务流程。
每个边缘有4个标签,因此在图形上打印它们时,我几乎看不到任何内容。
例如:
import networkx as nx
H=nx.Graph()
t_op=[437,325,60,633,2156,3029, 1973,151, 375]
arcs_H=[("Habitants", "Collectivites"), ("Activites", "Collectivites")]
H.add_edges_from(arcs_H)
H["Activites"]["Collectivites"]['weight']=t_op[7]
H["Activites"]["Collectivites"]['nature']="tva_logement"
H["Activites"]["Collectivites"]['vers']="Collectivites"
H["Activites"]["Collectivites"]['label']="Public"
H["Habitants"]["Collectivites"]['weight']=t_op[8]
H["Habitants"]["Collectivites"]['nature']="tva_bureaux"
H["Habitants"]["Collectivites"]['vers']="Collectivites"
H["Habitants"]["Collectivites"]['label']="Public"
pos=nx.spring_layout(H)
nx.draw(H, pos, with_labels=True)
nx.draw_networkx_edge_labels(H, pos, edge_labels=None, label_pos=0.5, font_size=10, font_color='k', font_family='serif', font_weight='normal', alpha=1.0, bbox=dict(facecolor='red', alpha=0.5), horizontalalignment='center', rotate=True)
plt.show()
我如何设法创建在边缘上方具有定义的高度和宽度的框?
谢谢
苏菲