i have stared nodes positions with networkx but matplotlib render it at wrong place. What is very important is to get the same picture each time i launch the script : so, nodes coordinates respect is fundamental.
Also, the view is too compact, forcing me too manually zoom inside, and appears in figure2 in place of figure1. finally, matplotlib works on little float scale [-1,1] where i prefer screen dimension x [0,1280] and y [0,704].
i have tried many source code but it still doesnt do the job properly
import matplotlib.pyplot as plt
import networkx as nx
zero_zero = 'zero_zero'
zero_one = 'zero_one'
one_zero = 'one_zero'
one_one = 'one_one'
foo_1 = 'foo_1'
foo_2 = 'foo_2'
foo_3 = 'foo_3'
bar_1 = 'bar_1'
bar_2 = 'bar_2'
bar_3 = 'bar_3'
stuff_1 = 'stuff_1'
stuff_2 = 'stuff_2'
stuff_3 = 'stuff_3'
waow = 'waow'
fig = plt.figure(figsize=(100,100))
fig, ax = plt.subplots()
ax.set_xlim(-1.5, 1.5)
ax.set_ylim(-1.5 , 1.5)
G = nx.Graph()
starpos={zero_zero:(0,0), zero_one:(0,1), one_zero:(1,0), one_one:(1,1), foo_1:(1,0),foo_2:(0.1,0.1),foo_3:(0.2,0.3),bar_1:(0.3,0.2),bar_2:(0.76,.80),bar_3:(0,0.2),stuff_1:(0.8,0.6),stuff_2:(0.3,0.9),stuff_3:(0.7,0.7),waow:(0.4,0.6)}
for k,v in starpos.items():
G.add_node(k,pos=v)
G.nodes(data=True)
G.add_edge(foo_1, foo_2)
G.add_edge(foo_3, bar_3)
G.add_edge(bar_1, foo_3)
G.add_edge(bar_1, bar_2)
G.add_edge(bar_3, bar_2)
G.add_edge(stuff_1, stuff_3)
G.add_edge(waow, bar_3)
G.add_edge(bar_2, stuff_3)
G.add_edge(zero_zero, zero_one)
G.add_edge(zero_one, one_zero)
G.add_edge(one_zero, one_one)
G.add_edge(one_one, zero_zero)
pos = nx.spring_layout(G)
nx.draw(G, pos, font_size=16, with_labels=False)
for p in pos: # raise text positions
pos[p][1] += 0.07
nx.draw_networkx_labels(G, pos)
plt.show()