Problem with redrawing of plots

Hello,
with the following source code, in which show_function is called after a key
event, I have 2 problems :-/:

1) each new drawing (i.e. new call of show_function) leads to a indermediate
redrawing of the previous plots, making the program slow

2) the 'button_press_event', which prints xdata/ydata, always prints the
coordinates of the first plot (so as if the axes are not updated by calling
show_function).

Any ideas? :working:

Thanks in advance!

Frederik

class CanvasFrame(wx.Frame):
  def __init__(self, ):
    wx.Frame.__init__(self,None,-1,'',size=(644,555))
    
...

def show_function(self,xname,x,yname,y,bestbkgr,bestprm,filename,numscan):
    from pylab import
plot,legend,title,xlabel,ylabel,show,close,figtext,savefig,clf
    
    self.frame=wx.Frame(self,-1)
                self.figure = figure()
                
                self.axes = self.figure.add_subplot(111)
    
    self.axes.plot(x,y,'k.')
    self.figure_canvas = FigureCanvas(self, -1, self.figure)
                
    self.sizer = wx.BoxSizer(wx.VERTICAL)
    self.sizer.Add(self.figure_canvas, 1, wx.EXPAND|wx.CENTER|wx.GROW)
    self.SetSizer(self.sizer)
    self.Fit()

    self.figure_canvas.mpl_connect('button_press_event', self.click)

···

--
View this message in context: http://www.nabble.com/Problem-with-redrawing-of-plots-tp18774397p18774397.html
Sent from the matplotlib - users mailing list archive at Nabble.com.