更改 Networkx 中的节点显示大小

发布于 2024-08-24 02:27:02 字数 325 浏览 1 评论 0原文

我没有使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

思念绕指尖 2024-08-31 02:27:02

尝试 nx.draw(G, node_size=size),其中 size 可以是标量或长度等于节点数的数组。

Try nx.draw(G, node_size=size), where size can be a scalar or an array of length equal to the number of nodes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文