Skip to content

Update some matplotlib.lines docstrings. #19751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 10 additions & 30 deletions lib/matplotlib/lines.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
The 2D line class which can draw with a variety of line styles, markers and
colors.
2D lines with support for a variety of line styles, markers, colors, etc.
"""

from numbers import Integral, Number, Real
Expand Down Expand Up @@ -715,26 +714,16 @@ def _transform_path(self, subslice=None):
self._transformed_path = TransformedPath(_path, self.get_transform())

def _get_transformed_path(self):
"""
Return the :class:`~matplotlib.transforms.TransformedPath` instance
of this line.
"""
"""Return this line's `~matplotlib.transforms.TransformedPath`."""
if self._transformed_path is None:
self._transform_path()
return self._transformed_path

def set_transform(self, t):
"""
Set the Transformation instance used by this artist.

Parameters
----------
t : `matplotlib.transforms.Transform`
"""
super().set_transform(t)
# docstring inherited
self._invalidx = True
self._invalidy = True
self.stale = True
super().set_transform(t)

def _is_sorted(self, x):
"""Return whether x is sorted in ascending order."""
Expand Down Expand Up @@ -1014,10 +1003,7 @@ def get_ydata(self, orig=True):
return self._y

def get_path(self):
"""
Return the :class:`~matplotlib.path.Path` object associated
with this line.
"""
"""Return the `~matplotlib.path.Path` associated with this line."""
if self._invalidy or self._invalidx:
self.recache()
return self._path
Expand Down Expand Up @@ -1477,9 +1463,8 @@ def draw(self, renderer):

class VertexSelector:
"""
Manage the callbacks to maintain a list of selected vertices for
`.Line2D`. Derived classes should override
:meth:`~matplotlib.lines.VertexSelector.process_selected` to do
Manage the callbacks to maintain a list of selected vertices for `.Line2D`.
Derived classes should override the `process_selected` method to do
something with the picks.

Here is an example which highlights the selected verts with red
Expand Down Expand Up @@ -1508,9 +1493,8 @@ def process_selected(self, ind, xs, ys):
"""
def __init__(self, line):
"""
Initialize the class with a `.Line2D` instance. The line should
already be added to some :class:`matplotlib.axes.Axes` instance and
should have the picker property set.
Initialize the class with a `.Line2D`. The line should already be
added to an `~.axes.Axes` and should have the picker property set.
"""
if line.axes is None:
raise RuntimeError('You must first add the line to the Axes')
Expand All @@ -1528,8 +1512,7 @@ def __init__(self, line):

def process_selected(self, ind, xs, ys):
"""
Default "do nothing" implementation of the
:meth:`process_selected` method.
Default "do nothing" implementation of the `process_selected` method.

Parameters
----------
Expand All @@ -1556,7 +1539,4 @@ def onpick(self, event):
fillStyles = MarkerStyle.fillstyles

docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))

# You can not set the docstring of an instancemethod,
# but you can on the underlying function. Go figure.
docstring.interpd(Line2D.__init__)