'Store button press if on top of the line.'

def on_press(self, event):

    if ((event.inaxes != self.line.axes) or (not self.line.contains(event)[0])):
        return
    x0 = self.line.get_xdata()
    y0 = self.line.get_ydata()
    self.press = (x0, y0, event.xdata, event.ydata)
