Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting Grid Graph

I'm trying to plot a grid graph, specifying exactly where vertices should be plotted. (I want the plot to look like an actual grid and later overlay a graphics object on it.) The following code gives a KeyError:

G=graphs.GridGraph([8,12])
pos_list=[(i,j) for i in range(8) for j in range(12)]
pos_dict={}
for i in range(len(pos_list)):
    pos_dict[i]=pos_list[i]
G.show(pos=pos_dict)

How can I get my plot to look like a regular grid?

click to hide/show revision 2
retagged

Plotting Grid Graph

I'm trying to plot a grid graph, specifying exactly where vertices should be plotted. (I want the plot to look like an actual grid and later overlay a graphics object on it.) The following code gives a KeyError:

G=graphs.GridGraph([8,12])
pos_list=[(i,j) for i in range(8) for j in range(12)]
pos_dict={}
for i in range(len(pos_list)):
    pos_dict[i]=pos_list[i]
G.show(pos=pos_dict)

How can I get my plot to look like a regular grid?