'Callback for dragging in zoom mode.'

def drag_zoom(self, event):

    if self._xypress:
        (x, y) = (event.x, event.y)
        (lastx, lasty, a, ind, view) = self._xypress[0]
        ((x1, y1), (x2, y2)) = np.clip([[lastx, lasty], [x, y]], a.bbox.min, a.bbox.max)
        if (self._zoom_mode == u'x'):
            (y1, y2) = a.bbox.intervaly
        elif (self._zoom_mode == u'y'):
            (x1, x2) = a.bbox.intervalx
        self.draw_rubberband(event, x1, y1, x2, y2)
