如何在运行 Python 中的代码时停止弹出igraph?

How to stop the igraph pop up when running the code in Python?

我正在使用 igraph 绘制我的 graphframes 图形,它不断弹出输出图像。我必须手动关闭 window 以便进程可以继续 运行。

这是我的代码:

from igraph import Graph, plot

ig = Graph.TupleList(g.edges.collect(), directed=False)
out = plot(ig, vertex_size=10, bbox=(0, 0, 500, 500))
out.save("graph.png")

如何禁用弹出窗口window?

如果您查看 plot 函数的参考资料,您会发现有一个名为 target 的参数。 target 的默认值为 None 并且它会尝试在未指定目标的情况下打开图像查看器。您也可以给它一个带有文件名的字符串。 https://igraph.org/python/doc/api/igraph.drawing.html#plot

试试这样使用它:

out = plot(ig, target='graph.png', vertex_size=10, bbox=(0, 0, 500, 500))