'Handle mouse movements.'

def on_motion(self, event):

    if (self.press is None):
        return
    if (event.inaxes != self.cbar.ax):
        return
    yprev = self.press
    dy = (event.y - yprev)
    self.press = event.y
    scale = (self.cbar.norm.vmax - self.cbar.norm.vmin)
    perc = 0.03
    if (event.button == 1):
        self.cbar.norm.vmin -= ((perc * scale) * np.sign(dy))
        self.cbar.norm.vmax -= ((perc * scale) * np.sign(dy))
    elif (event.button == 3):
        self.cbar.norm.vmin -= ((perc * scale) * np.sign(dy))
        self.cbar.norm.vmax += ((perc * scale) * np.sign(dy))
    self.cbar.draw_all()
    self.mappable.set_norm(self.cbar.norm)
    self.cbar.patch.figure.canvas.draw()
