problems with embedding in wx on 0.5alpha

Hi john,

After the refactoring you did for version 0.5 I am having a funny behavior in a plot embedded in wx:

the frame appers with the size of the toolbar, but if I resize the frame the plot is there and is not resizable, it justs stays the same no matter the size of the canvas(frame?).

I've made the changes to my original module acording to the revised 'embedding_in_wx.py' example, which runs fine.

Here is my ploting module:

···

===============================================

import matplotlib
matplotlib.use('WX')
   from matplotlib.backends.backend_wx import Toolbar, FigureManager, FigureCanvasWx
from matplotlib.figure import Figure
from matplotlib.axes import Subplot
import Numeric as numpy
from RandomArray import *
from MLab import *

from wxPython.wx import *

def create(parent):
    return PlotFigure(parent)

class PlotFigure(wxFrame):

    def __init__(self,parent):
        wxFrame.__init__(self,None,-1,"Results")
        self.fig = Figure((5,4), 75)
        self.canvas = FigureCanvasWx(self,-1,self.fig)
        self.toolbar = Toolbar(self.canvas)
        self.toolbar.Realize()

        # On Windows, default frame size behaviour is incorrect
        # you don't need this under Linux
        tw, th = self.toolbar.GetSizeTuple()
        fw, fh = self.canvas.GetSizeTuple()
        self.toolbar.SetSize(wxSize(fw, th))
               # Create a figure manager to manage things
        self.figmgr = FigureManager(self.canvas, 1, self)
               # Now put all into a sizer
        sizer = wxBoxSizer(wxVERTICAL)
        # This way of adding to sizer prevents resizing
        #sizer.Add(self.fig, 0, wxLEFT|wxTOP)
               # This way of adding to sizer allows resizing
        sizer.Add(self.toolbar, 1, wxLEFT|wxTOP|wxGROW)
               # Best to allow the toolbar to resize!
        sizer.Add(self.toolbar, 0, wxGROW)
        self.SetSizer(sizer)
        self.Fit()
           def plotLine(self,y, leg, tit='Time Series'):
        """
        Generate line plots
        """
        # Use ths line if using a toolbar
        a = self.figmgr.add_subplot(211)
               # Or this one if there is no toolbar
        #a = Subplot(self.fig, 211)
        styles = ('-', '--', ':', '.', 'o', '^', 'v', '<', '>', 's', '+')
        colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k')
        s = 0
        c = 0
        for i in range(numpy.shape(y)[0]):
            if s > len(styles)-1:
                s = 0
            if c > len(colors)-1:
                c = 0
            style = styles[s]
            color = colors[c]
            a.plot(y[i,:],style+color) # plot each line with a different combination of color and style
            if c == len(colors)-1:
                s += 1
            c += 1
        a.set_title(tit)
        a.legend(leg)
        self.toolbar.update()

===============================================

which I call like this: (I import the plotting module as PF)

self.fig = PF.create(None)
        leg = self.modict["slabels"]
        tit = 'Time Series and Final State'
        self.fig.plotLine(results, leg, tit)
               self.fig.plotBar(results, leg)
               self.fig.Show()