如何设置networkx线长度?

2024-06-26 14:15:05 发布

您现在位置:Python中文网/ 问答频道 /正文

长句被剪掉,看不见。 如何设置networkx线长度? 我试过设定体型。但是这条线的长度一起增加了。 我的图像:
my image `

import matplotlib.pyplot as plt
import networkx as nx

graph = nx.Graph()
graph.add_nodes_from(('looooooooooooongtext','shorttext','asdasdasd',4,5))
graph.add_edges_from([('looooooooooooongtext','shorttext'), ('looooooooooooongtext','asdasdasd'),('looooooooooooongtext',5),('asdasdasd',5)])
graph.add_edge('looooooooooooongtext',4,weight=1)
plt.figure('result',figsize=(10,10))
nx.draw_circular(graph, with_labels=True,node_size=80,font_size=10)
plt.show()

`


Tags: from图像importnetworkxaddsizeasplt