How to update the contents of a FigureCanvasTkAgg
Posted
by
Copo
on Stack Overflow
See other posts from Stack Overflow
or by Copo
Published on 2012-08-25T17:57:10Z
Indexed on
2012/08/30
21:38 UTC
Read the original article
Hit count: 333
I'm plotting some data in a Tkinter FigureCanvasTkagg using matplotlib. I need to clear the figure where i plot data and draw new data when a button is pressed. here is the plotting part of the code (there's an App class defined before..)
self.fig = figure()
self.ax = self.fig.add_subplot(111)
self.ax.set_ylim( min(y), max(y) )
self.line, = self.ax.semilogx(x,y,'.-') #tuple of a single element
self.canvas = FigureCanvasTkAgg(self.fig,master=master)
self.ax.semilogx(x,y,'o-')
self.canvas.show()
self.canvas.get_tk_widget().pack(side='top', fill='both', expand=1)
self.frame.pack()
how do i update the contents of such a canvas?
regards,
Jacopo
© Stack Overflow or respective owner