【发布时间】:2016-06-08 14:17:21
【问题描述】:
我正在编写一个程序,它为特定的输入字符串生成可满足的模型(连接图)。这里的细节并不重要,但主要问题是每个节点都有一个标签,而这个标签可能很长。因此,发生的情况是它不适合导致显示所有节点但部分标签显示的图形......此外,显示的图形不提供缩小选项,因此无法捕获一个图上带有完整标签的整个图。
有人可以帮助我并提出解决方案吗?
for i in range(0,len(Graphs)):
graph = Graphs[i]
custom_labels={}
node_colours=['y']
for node in graph.nodes():
custom_labels[node] = graph.node[node]
node_colours.append('c')
#nx.circular_layout(Graphs[i])
nx.draw(Graphs[i], nx.circular_layout(Graphs[i]), node_size=1500, with_labels=True, labels = custom_labels, node_color=node_colours)
#show with custom labels
fig_name = "graph" + str(i) + ".png"
#plt.savefig(fig_name)
plt.show()
【问题讨论】:
标签: python-2.7 matplotlib networkx