def METHOD_NAME(self, ax):
    """
    Mouse pan handler
    """
    def onPress(event):
        if event.inaxes != ax:
            return
        self.cur_xlim = ax.get_xlim()
        self.cur_ylim = ax.get_ylim()
        self.press = self.x0, self.y0, event.xdata, event.ydata
        self.x0, self.y0, self.xpress, self.ypress = self.press
    def onRelease(event):
        self.press = None
        ax.figure.canvas.draw()
    def onMotion(event):
        if self.press is None:
            return
        if event.inaxes != ax:
            return
        dx = event.xdata - self.xpress
        dy = event.ydata - self.ypress
        self.cur_xlim -= dx
        self.cur_ylim -= dy
        ax.set_xlim(self.cur_xlim)
        ax.set_ylim(self.cur_ylim)
        ax.figure.canvas.draw()
    fig = ax.get_figure()  # get the figure of interest
    # attach the call back
    fig.canvas.mpl_connect('button_press_event', onPress)
    fig.canvas.mpl_connect('button_release_event', onRelease)
    fig.canvas.mpl_connect('motion_notify_event', onMotion)
    # return the function
    return onMotion