title: sizing problems embedding matplotlib figure in wxpython GUI
body: <p>I have some code that generates a plot.  This code was written using pylab's interactive mode, but at this point I need to re-write the code so that I can embed the plot into my wxPython GUI.  The problem is, the figure shows up squished down into a small default size that I can't seem to change.  The frame can be manually resized and then everything looks good.  </p>
  
  <p>Here is a simple example that demonstrates the basic problem:</p>
  
  <pre><code>import wx
  import matplotlib
  import matplotlib.pyplot as plt
  import numpy as np
  
  
  class CanvasPanel(wx.Panel):
      def __init__(self, parent):
          wx.Panel.__init__(self, parent)
          self.figure = self.fake_depthplot()                                                               
          self.canvas = FigureCanvas(self, -1, self.figure)
          self.sizer = wx.BoxSizer(wx.VERTICAL)
          self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
          self.SetSizer(self.sizer)
          self.Fit()
          # these print statements give me a number like (1600, 1600)
          # however, when I use the wxpython inspector, it shows that the actual display size is MUCH smaller
          print self.Size 
          print self.canvas.Size
  
      def fake_depthplot(self):
          main_plot = plt.figure(1, figsize=(10, 8))
          main_plot.add_axes([0, 0, 1, 1])
  
          x1 = np.linspace(0.0, 5.0)
          x2 = np.linspace(0.0, 2.0)
  
          y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
          y2 = np.cos(2 * np.pi * x2)
  
          plt.subplot(4, 2, 1)
          plt.plot(x1, y1, 'ko-')
          plt.title('A tale of 2 subplots')
          plt.ylabel('Damped oscillation')
  
          plt.subplot(2, 1, 2)
          plt.plot(x2, y2, 'r.-')
          plt.xlabel('time (s)')
          plt.ylabel('Undamped')
  
          return main_plot
  
  
  if __name__ == "__main__":
      app = wx.PySimpleApp()
      fr = wx.Frame(None, title='test')
      panel = CanvasPanel(fr)                                                                                                         
      if '-i' in sys.argv:
          import wx.lib.inspection
          wx.lib.inspection.InspectionTool().Show()
      fr.Show()
      app.MainLoop()
  </code></pre>
  
  <p>I'd like for the frame to be maybe twice as large as it is currently.  Also, when I run this code, the display seems to flash into existence as larger, but then it resizes to the default I don't like very quickly.  I'm guessing this has a simple solution, but I can't seem to find it.  None of the answers I have found for other questions fix my problem.  </p>