I\'ve made a script which uses matplotlib
\'s FuncAnimation
function to animate a series of contour plots for paraboloid surface functions. I\'d lik
Here is a lazy way to add colorbar. Instead of updating colorbar object, this code delete and create all objects in fig
.
N = 10 # number of color steps
vmin, vmax = 0, 10 # this should be min and max of z
V = np.linspace(vmin, vmax, N)
fig = plt.figure()
def animate(index):
fig.clear()
ax = plt.subplot(1,1,1)
zi = ml.griddata(x, y, zlist[index], xi, yi, interp='linear')
contourplot = ax.contourf(xi, yi, zi, V, cmap=plt.cm.hsv,origin='lower')
cbar = plt.colorbar(contourplot)
ax.set_title('%03d'%(index))
return ax