code: def update(self, figure):
          
  
          if hasattr(self, "figure_canvas"):
              self.figure_canvas.Destroy()
  
          self.figure_canvas = self._get_figure_canvas(figure)
  
          self.figure_canvas.SetSize(self.GetSize())
          figure.subplots_adjust()
  
          self.main_sizer.Add(self.figure_canvas, 1,
                              wx.EXPAND | wx.FIXED_MINSIZE, 0)
  
          self.Layout()
          self.figure_canvas.draw()
docs: Updates figure on data change
  
          Parameters
          ----------
          * figure: matplotlib.figure.Figure
          \tMatplotlib figure object that is displayed in self