def displayGraph2( nbPillar,g,r, lw):
x1 = []
x2 = []
y1 = []
y2 = []
lines = []
c = []
d2 = copy.deepcopy(g)
while len(d2) > 0:
n1 = d2.keys()[0]
n2 = d2[n1].keys()[0]
c1 = pillar2tocart(n1,nbPillar,r)
c2 = pillar2tocart(n2,nbPillar,r)
#x1.append(c1[0])
#x2.append(c2[0])
#y1.append(c1[1])
#y2.append(c2[1])
lines.append(((c1[0],-c1[1]),(c2[0],-c2[1])))
c.append( (0,0,0,1) )
decreaseWeightEdge(d2,n1,n2)
#lines = plt.plot( np.stack(x1),np.stack(y1),np.stack(x2),np.stack(y2))
#plt.setp(lines, color='white', linewidth=1.0)
#plt.gca().set_axis_bgcolor('black')
lc = mc.LineCollection(lines,colors=np.array(c) ,linewidths=lw)
fig, ax = pl.subplots()
ax.add_collection(lc)
ax.autoscale()
ax.margins(0.1)
fig.show()
#plt.show()
评论列表
文章目录