更改 Networkx 中的节点显示大小
我没有使用 GraphViz,因为我在使其与 Networkx 配合良好时遇到问题。我知道这很奇怪,但我已经尝试了很多建议来解决这个问题,但我似乎拥有世界上最糟糕的运气。因此,我遇到的问题必须使用 Networkx 来解决,而不使用 GraphViz。
我的程序读取文档并尝试根据文档的内容绘制思维导图。然而,在实际绘制节点时,Networkx 似乎有一个默认大小。这对我来说很糟糕,因为大量文本进入我的每个节点。我需要一种方法来增加节点的显示大小(任意地,基于属于该节点的文本的大小)。
我尝试查看 Networkx 网站、SO 上的其他问题以及 Google 的大约 200 个搜索结果,但没有成功。
I am not using GraphViz because I am having problems with making it play nice with Networkx. I know this is weird, but I've tried many suggestions to fix this problem, but I just seem to have some of the worst luck in the world. Therefore the problem that I have must be solved withing Networkx without using GraphViz.
My program reads a document and and tries to draw something of a MindMap based on the contents of the document. However, Networkx seems to have a default size when it comes to actually drawing the node. This is bad for me because a lot of text goes into each of my nodes. I need a way to increase the display-size of my nodes (arbitrarily, based on the size of the text that belongs in that node).
I have tried looking at the Networkx site, other questions on SO and about 200 search results from Google, with no luck.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
nx.draw(G, node_size=size)
,其中
size
可以是标量或长度等于节点数的数组。Try
nx.draw(G, node_size=size
), wheresize
can be a scalar or an array of length equal to the number of nodes.