huy
huy

Reputation: 1914

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

I am using igraph to plot my graphframes graph and it keeps pop up the output image. I have to manually close the window so the process can continue to run.

This is my code:

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")

How can I disable the popup window?

Upvotes: 0

Views: 59

Answers (1)

Shubham Vasaikar
Shubham Vasaikar

Reputation: 728

If you look at the reference for the plot function, you can see that there is a parameter called target. The default value for target is None and it tries to open an image viewer is no target is specified. You can also give it a string with a file name. https://igraph.org/python/doc/api/igraph.drawing.html#plot

Try using it like this:

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

Upvotes: 2

Related Questions