tôi thấy điều này hướng dẫn ngắn tuyệt vời trên hình ảnh động:matplotlib imshow(): làm thế nào để animate?
http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
tuy nhiên tôi không thể tạo ra một imshow hoạt hình() lô cùng thời trang. tôi đã cố gắng để thay thế một số dòng:
# First set up the figure, the axis, and the plot element we want to animate
fig = plt.figure()
ax = plt.axes(xlim=(0, 10), ylim=(0, 10))
#line, = ax.plot([], [], lw=2)
a=np.random.random((5,5))
im=plt.imshow(a,interpolation='none')
# initialization function: plot the background of each frame
def init():
im.set_data(np.random.random((5,5)))
return im
# animation function. This is called sequentially
def animate(i):
a=im.get_array()
a=a*np.exp(-0.001*i) # exponential decay of the values
im.set_array(a)
return im
nhưng tôi chạy vào lỗi bạn có thể giúp tôi có được chạy này? cảm ơn bạn trước. tốt nhất,
Như một mặt lưu ý, một thói quen tốt để bao gồm những lỗi bạn đang nhận được trong câu hỏi của bạn. – tacaswell