'Test whether the mouse event occurred on the line.  The pick
radius determines the precision of the location test (usually
within five points of the value).  Use
:meth:`~matplotlib.lines.Line2D.get_pickradius` or
:meth:`~matplotlib.lines.Line2D.set_pickradius` to view or
modify it.
Returns *True* if any values are within the radius along with
``{\'ind\': pointlist}``, where *pointlist* is the set of points
within the radius.
TODO: sort returned indices by distance'

def contains(self, mouseevent):

    if callable(self._contains):
        return self._contains(self, mouseevent)
    if (not is_numlike(self.pickradius)):
        raise ValueError(u'pick    radius    should    be    a    distance')
    if (self._invalidy or self._invalidx):
        self.recache()
    if (len(self._xy) == 0):
        return (False, {})
    transformed_path = self._get_transformed_path()
    (path, affine) = transformed_path.get_transformed_path_and_affine()
    path = affine.transform_path(path)
    xy = path.vertices
    xt = xy[:, 0]
    yt = xy[:, 1]
    if (self.figure is None):
        warnings.warn(u'no    figure    set    when    check    if    mouse    is    on    line')
        pixels = self.pickradius
    else:
        pixels = ((self.figure.dpi / 72.0) * self.pickradius)
    with np.errstate(all=u'ignore'):
        if (self._linestyle in [u'None', None]):
            d = (((xt - mouseevent.x) ** 2) + ((yt - mouseevent.y) ** 2))
            (ind,) = np.nonzero(np.less_equal(d, (pixels ** 2)))
        else:
            ind = segment_hits(mouseevent.x, mouseevent.y, xt, yt, pixels)
            if self._drawstyle.startswith(u'steps'):
                ind //= 2
    ind += self.ind_offset
    return ((len(ind) > 0), dict(ind=ind))
