wxpython with matplotlib doesn't initialize
Question: I tried to use `matplotlib` in `wxpython`, but there is some problem.

    
    
    import wx
    from matplotlib.figure import Figure
    import numpy as np
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
    
    class MplCanvasFrame(wx.Frame):
        def _init_(self,parent):
            wx.Frame._init_(self, parent, size=(600, 400),
                            title='Matplotlib Figure with Navigation Toolbar')
            self.figure = Figure()
    
            self.axes = self.figure.add_subplot(111)
    
            x = np.arange(0, 6, .01)
            y = np.sin(x**2)*np.exp(-x)
            self.axes.plot(x, y)
            self.canvas = FigureCanvas(self, -1, self.figure)
    app = wx.App(redirect = False)
    frame = MplCanvasFrame(None)
    frame.Show()
    app.MainLoop()
    

It doesn't draw the curve at all.

but when I try this:

* * *
    
    
    import wx
    import wx
    from matplotlib.figure import Figure
    import numpy as np
    from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
    
    app = wx.App()
    frame = wx.Frame(None, title = 'dasf',size = (600, 400))
    figure = Figure()
    axes = figure.add_subplot(111)
    x = np.arange(0, 6, .01)
    y = np.sin(x**2)*np.exp(-x)
    axes.plot(x, y)
    canvas = FigureCanvas(frame, -1, figure)
    frame.Show()
    app.MainLoop()
    

The curve is drawed.

Why?


Answer: I believe the problem is the spelling of `__init__`. there should be two
underscores on each side (note that this is in two places in the code).

