igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] grid graphs


From: Tamás Nepusz
Subject: Re: [igraph] grid graphs
Date: Mon, 11 Nov 2013 22:45:51 +0100

Thank you. How can I then persuade igraph to plot the graph on a 2d
grid maintaining the original position of the nodes?
>>> layout = [index_to_grid_coords(i) for i in xrange(g.vcount())]
>>> plot(g, layout=layout)

Explanation: the layout=… keyword argument of plot() simply expects a Layout object or a list of (x, y) coordinates, one for each vertex in the graph. I simply construct such a list using the index_to_grid_coords() function and then pass that to plot() as the layout keyword.

— 
T.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]