Dear all,
I wanted to reciprocate the effect of :
       import matplotlib.pyplot as plt}
       plt.imshow(image1)
       plt.pause(0.7)
       plt.imshow(image2)
in a code making use of Tkinter and FigureCanvastkAgg;
Which lookes something like this :


f = Figure(figsize=(6,6))

    a = f.add_subplot(111)
    image = np.array(np.random.random((1024,1024))*100,dtype=int)
    a.imshow(image)

    canvas = FigureCanvasTkAgg(f, self)
    canvas.show()
    canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)`

If I want to plot another image2 in the same graph. How could I do it?

I tried another method but was not able to obtain the desired output:

> ​
>
        self.i = 0

        def Plot():

            print self.i

            self.f = Figure(figsize=(6,6))

            self.a = self.f.add_subplot(111)

            image = np.array(np.random.random((1024,1024))*100,dtype=int)


>
>             if self.i <20:

                self.i = self.i+1

                self.a.imshow(image)

                self.canvas = FigureCanvasTkAgg(self.f, self)

                self.canvas.show()

                self.parent.after(500,Plot)



        Plot()


>


>

        self.canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH,
> expand=True)

        toolbar = NavigationToolbar2TkAgg(self.canvas, self)

        toolbar.update()

        self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)

​
>
>
Awaiting your reply.
-- 
Regards,
Aishwarya Selvaraj
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to