Skip to content

Commit 2caab1b

Browse files
committed
Update some matplotlib.lines docstrings.
(The comment at the end regarding instance methods is completely outdated and doesn't even match the current code anymore.)
1 parent 91cb8a8 commit 2caab1b

File tree

1 file changed

+10
-30
lines changed

1 file changed

+10
-30
lines changed

lib/matplotlib/lines.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""
2-
The 2D line class which can draw with a variety of line styles, markers and
3-
colors.
2+
2D lines with support for a variety of line styles, markers, colors, etc.
43
"""
54

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

717716
def _get_transformed_path(self):
718-
"""
719-
Return the :class:`~matplotlib.transforms.TransformedPath` instance
720-
of this line.
721-
"""
717+
"""Return this line's `~matplotlib.transforms.TransformedPath`."""
722718
if self._transformed_path is None:
723719
self._transform_path()
724720
return self._transformed_path
725721

726722
def set_transform(self, t):
727-
"""
728-
Set the Transformation instance used by this artist.
729-
730-
Parameters
731-
----------
732-
t : `matplotlib.transforms.Transform`
733-
"""
734-
super().set_transform(t)
723+
# docstring inherited
735724
self._invalidx = True
736725
self._invalidy = True
737-
self.stale = True
726+
super().set_transform(t)
738727

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

10161005
def get_path(self):
1017-
"""
1018-
Return the :class:`~matplotlib.path.Path` object associated
1019-
with this line.
1020-
"""
1006+
"""Return the `~matplotlib.path.Path` associated with this line."""
10211007
if self._invalidy or self._invalidx:
10221008
self.recache()
10231009
return self._path
@@ -1477,9 +1463,8 @@ def draw(self, renderer):
14771463

14781464
class VertexSelector:
14791465
"""
1480-
Manage the callbacks to maintain a list of selected vertices for
1481-
`.Line2D`. Derived classes should override
1482-
:meth:`~matplotlib.lines.VertexSelector.process_selected` to do
1466+
Manage the callbacks to maintain a list of selected vertices for `.Line2D`.
1467+
Derived classes should override the `process_selected` method to do
14831468
something with the picks.
14841469
14851470
Here is an example which highlights the selected verts with red
@@ -1508,9 +1493,8 @@ def process_selected(self, ind, xs, ys):
15081493
"""
15091494
def __init__(self, line):
15101495
"""
1511-
Initialize the class with a `.Line2D` instance. The line should
1512-
already be added to some :class:`matplotlib.axes.Axes` instance and
1513-
should have the picker property set.
1496+
Initialize the class with a `.Line2D`. The line should already be
1497+
added to an `~.axes.Axes` and should have the picker property set.
15141498
"""
15151499
if line.axes is None:
15161500
raise RuntimeError('You must first add the line to the Axes')
@@ -1528,8 +1512,7 @@ def __init__(self, line):
15281512

15291513
def process_selected(self, ind, xs, ys):
15301514
"""
1531-
Default "do nothing" implementation of the
1532-
:meth:`process_selected` method.
1515+
Default "do nothing" implementation of the `process_selected` method.
15331516
15341517
Parameters
15351518
----------
@@ -1556,7 +1539,4 @@ def onpick(self, event):
15561539
fillStyles = MarkerStyle.fillstyles
15571540

15581541
docstring.interpd.update(Line2D_kwdoc=artist.kwdoc(Line2D))
1559-
1560-
# You can not set the docstring of an instancemethod,
1561-
# but you can on the underlying function. Go figure.
15621542
docstring.interpd(Line2D.__init__)

0 commit comments

Comments
 (0)