fig = plt.figure()
im = plt.contour(xi, yi, zi[0], 15, linewidths=0.5, colors='k')
ax = fig.gca()
ani = animation.FuncAnimation(fig, update_contour_plot, frames=range(
    numframes), fargs=(zi, ax, fig, xi, yi), interval=100)
plt.colorbar(im)
plt.show()
return ani

def update_contour_plot(i, data, ax, fig, xi, yi):
    ax.cla()
im = ax.contour(xi, yi, data[i], 15, linewidths=0.5, colors='k')
plt.title(str(i))
return im,
Animation with contours matplotlib