Skip to content

Commit fbdae90

Browse files
committed
Use docstring.Substitution instead of editing __doc__
1 parent 9ed4cac commit fbdae90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/widgets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import numpy as np
1717

1818
import matplotlib as mpl
19+
from matplotlib import docstring
1920
from . import _api, cbook, colors, ticker
2021
from .lines import Line2D
2122
from .patches import Circle, Rectangle, Ellipse
@@ -2576,6 +2577,7 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
25762577
"""
25772578

25782579

2580+
@docstring.Substitution(_RECTANGLESELECTOR_PARAMETERS_DOCSTRING)
25792581
class RectangleSelector(_SelectorWidget):
25802582
"""
25812583
Select a rectangular region of an axes.
@@ -2600,7 +2602,6 @@ class RectangleSelector(_SelectorWidget):
26002602
26012603
See also: :doc:`/gallery/widgets/rectangle_selector`
26022604
"""
2603-
__doc__ %= (_RECTANGLESELECTOR_PARAMETERS_DOCSTRING)
26042605

26052606
_shape_klass = Rectangle
26062607

@@ -2968,6 +2969,7 @@ def geometry(self):
29682969
return np.array(self._to_draw.get_data())
29692970

29702971

2972+
@docstring.Substitution(_RECTANGLESELECTOR_PARAMETERS_DOCSTRING)
29712973
class EllipseSelector(RectangleSelector):
29722974
"""
29732975
Select an elliptical region of an axes.
@@ -3004,7 +3006,6 @@ class EllipseSelector(RectangleSelector):
30043006
>>> fig.canvas.mpl_connect('key_press_event', toggle_selector)
30053007
>>> plt.show()
30063008
"""
3007-
__doc__ %= (_RECTANGLESELECTOR_PARAMETERS_DOCSTRING)
30083009

30093010
_shape_klass = Ellipse
30103011
draw_shape = _api.deprecate_privatize_attribute('3.5')

0 commit comments

Comments
 (0)