'Translate mouse wheel events into matplotlib events'

def _onMouseWheel(self, evt):

    x = evt.GetX()
    y = (self.figure.bbox.height - evt.GetY())
    delta = evt.GetWheelDelta()
    rotation = evt.GetWheelRotation()
    rate = evt.GetLinesPerAction()
    step = ((rate * float(rotation)) / delta)
    evt.Skip()
    if (wx.Platform == u'__WXMAC__'):
        if (not hasattr(self, u'_skipwheelevent')):
            self._skipwheelevent = True
        elif self._skipwheelevent:
            self._skipwheelevent = False
            return
        else:
            self._skipwheelevent = True
    FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=evt)
