'Move the line on drag.'

def on_motion(self, event):

    if (self.press is None):
        return
    if (event.inaxes != self.line.axes):
        return
    (x0, y0, xpress, ypress) = self.press
    dx = (event.xdata - xpress)
    self.line.set_xdata((x0 + dx))
    self.line.figure.canvas.draw()
