From: Werner F. B. <wer...@fr...> - 2005-04-15 17:24:24
|
Hi Matt, Matt Newville wrote: > Hi Werner, > > I think what you may want is something like this: > > def OnButton1Button(self, event): > print 'done it' > ### self.figure.clear() > ### self.axes = self.figure.add_subplot(111) > self.axes.cla() # <-- clear the axes > t = arange(0.0,4.0,0.01) > s = sin(2*pi*t) > > self.axes.plot(t,s) > self.axes.set_xlabel('Time 2 (s)') > self.axes.set_ylabel('Price 2 ($)') > self.canvas.draw() # <-- force a redraw > > Is that OK? It works for me on Windows and Linux. I do the > same thing for 'make a fresh plot' in my own codes that I know > work OK on Mac OS X as well. Yes, that works too. So, I can do: self.figure.clear() ... self.canvas.Refresh() or: self.axes.cla() ... self.canvas.draw() or: self.figure.clear() ... self.canvas.draw() Note that all of the above still have problems if I do: self.figure = Figure(frameon=False) i.e. the "frameon=False" bit causes the figure/axes not to get totally cleared. > > Cheers, > > --Matt > > See you Werner |