Hello All, 

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.

def complicated_image(Timestep):
        """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.]

def animate_image():
        f1 = figure()
        ax = gca()
        
        for i in range(100):
                ax.cla()
                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)
                
                f1.savefig('slidertest%03d.png'%i)


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.



Regards
Bhargav Vaidya


                
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to