I have two questions regarding the matplotlib Slider and animation.
Question 1: How to create an image along with a Slider axes, such that the Slider values changes with time?
Here is the example structure of the code I am trying but unsuccessful to have an animated Slider that changes with time.
"""Write code to create complicated image where all variables to plot are certain functions of Timestep"""
p2 = plt.quiver(X,Y,Z1,Z2)
p3 = plt.pcolormesh(Delta0)
p1 = plt.contour(r,z,value,10)
return plt.gca() [ Question 2 : Is there are better way to return the axis so that it can be used in the animate_image function.]
f1 = figure()
ax = gca()
for i in range(100):
ax = complicated_image(i)
axtime = plt.axes([0.1,0.01,0.8,0.02],axisbg='white')
stime = Slider(axtime,'TimeStep',0,100,valinit=0)
If I omit the lines containing the axtime axes (i.e. the part related to Slider) then I get the image properly that changes with time but of course without the Slider.