Update Bar_Chart + Récup_mat.py
This commit is contained in:
parent
fd9d1f494e
commit
b532490455
|
@ -28,28 +28,28 @@ def matRecup(i, param):
|
||||||
return matR
|
return matR
|
||||||
|
|
||||||
def animation_strat():
|
def animation_strat():
|
||||||
|
fig=plt.figure()
|
||||||
fig=plt.figure()
|
fig.suptitle('Animation des stratégies')
|
||||||
fig.suptitle('Animation des stratégies')
|
cmap = mpl.colors.ListedColormap(["black","green" ,"red" ,"blue" ,"yellow"])
|
||||||
cmap = mpl.colors.ListedColormap(["black","green" ,"red" ,"blue" ,"yellow"])
|
bounds=[0,1,2,3,4,5]
|
||||||
bounds=[0,1,2,3,4,5]
|
norm=mpl.colors.BoundaryNorm(bounds, cmap.N)
|
||||||
norm=mpl.colors.BoundaryNorm(bounds, cmap.N)
|
img=plt.imshow(matRecup(0, 'strategie'), interpolation = "nearest", cmap = cmap , norm = norm)
|
||||||
img=plt.imshow(matRecup(0, 'strategie'), interpolation = "nearest", cmap = cmap , norm = norm)
|
|
||||||
|
|
||||||
cb=plt.colorbar(img , cmap=cmap , norm=norm , boundaries = bounds , ticks=bounds)
|
cb=plt.colorbar(img , cmap=cmap , norm=norm , boundaries = bounds , ticks=bounds)
|
||||||
labels = np.arange(1, 6, 1)
|
labels = np.arange(1, 6, 1)
|
||||||
cb.set_ticklabels(labels)
|
cb.set_ticklabels(labels)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def update(next_iteration,*args):
|
def update(next_iteration,*args):
|
||||||
img.set_array(matRecup(next_iteration , 'strategie'))
|
img.set_array(matRecup(next_iteration , 'strategie'))
|
||||||
return [img]
|
return [img]
|
||||||
|
|
||||||
anim = animation.FuncAnimation(fig, update, frames=range(MaxIterations), interval=1000, repeat = False)
|
anim = animation.FuncAnimation(fig, update, frames=range(MaxIterations), interval=1000, repeat = False)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue