def animateMatrices(matrices,outputFilename = None):
fig = plot.figure() # make figure
im = plot.imshow(matrices[0], cmap=plot.get_cmap('bone'), vmin=0.0, vmax=1.0)
# function to update figure
def updatefig(j):
# set the data in the axesimage object
im.set_array(matrices[j])
# return the artists set
return im,
# kick off the animation
ani = animation.FuncAnimation(fig, updatefig, frames=range(len(matrices)),
interval=50, blit=True)
if outputFilename != None:
ani.save(outputFilename, dpi = 80,writer = 'imagemagick')
plot.show()
评论列表
文章目录