Skip to content

Commit ae16462

Browse files
committed
Improve docstring: add links to properties description, clarify default values.
1 parent 0885e2e commit ae16462

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

lib/matplotlib/widgets.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,7 @@ def on_select(min: float, max: float) -> Any
20252025
props : dict, optional
20262026
Dictionary of `matplotlib.patches.Patch` properties.
20272027
Default:
2028+
20282029
``dict(facecolor='red', alpha=0.5)``
20292030
20302031
onmove_callback : func(min, max), min/max are floats, default: None
@@ -2043,7 +2044,7 @@ def on_select(min: float, max: float) -> Any
20432044
20442045
handle_props : dict, default: None
20452046
Properties of the handle lines at the edges of the span. Only used
2046-
when *interactive* is True. See `~matplotlib.lines.Line2D` for valid
2047+
when *interactive* is True. See `matplotlib.lines.Line2D` for valid
20472048
properties.
20482049
20492050
handle_grab_distance : float, default: 10
@@ -2539,9 +2540,11 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
25392540
backend).
25402541
25412542
props : dict, optional
2542-
Properties with which the __ARTIST_NAME__ is drawn.
2543+
Properties with which the __ARTIST_NAME__ is drawn. See
2544+
`matplotlib.patches.Patch` for valid properties.
25432545
Default:
2544-
``dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True))``
2546+
2547+
``dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)``
25452548
25462549
spancoords : {"data", "pixels"}, default: "data"
25472550
Whether to interpret *minspanx* and *minspany* in data or in pixel
@@ -2555,7 +2558,11 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
25552558
activated.
25562559
25572560
handle_props : dict, optional
2558-
Properties with which the interactive handles are drawn.
2561+
Properties with which the interactive handles (marker artists) are
2562+
drawn. See the marker arguments in `matplotlib.lines.Line2D` for valid
2563+
properties. Default values are defined in ``mpl.rcParams`` except for
2564+
the default value of ``markeredgecolor`` which will be the same as the
2565+
``edgecolor`` property in *props*.
25592566
25602567
interactive : bool, default: False
25612568
Whether to draw a set of handles that allow interaction with the
@@ -2670,9 +2677,11 @@ def __init__(self, ax, onselect, drawtype='box',
26702677
self.handle_grab_distance = handle_grab_distance
26712678

26722679
if props is None:
2673-
_handle_props = dict(markeredgecolor='r')
2680+
_handle_props = dict(markeredgecolor='black')
26742681
else:
2675-
_handle_props = dict(markeredgecolor=props.get('edgecolor', 'r'))
2682+
_handle_props = dict(
2683+
markeredgecolor=props.get('edgecolor', 'black')
2684+
)
26762685
_handle_props.update(cbook.normalize_kwargs(handle_props,
26772686
Line2D._alias_map))
26782687
self._corner_order = ['NW', 'NE', 'SE', 'SW']
@@ -3086,9 +3095,8 @@ def onselect(verts):
30863095
Whether to use blitting for faster drawing (if supported by the
30873096
backend).
30883097
props : dict, optional
3089-
Properties with which the line is drawn.
3090-
Default:
3091-
``dict()``
3098+
Properties with which the line is drawn, see `matplotlib.lines.Line2D`
3099+
for valid properties. Default values are defined in ``mpl.rcParams``.
30923100
button : `.MouseButton` or list of `.MouseButton`, optional
30933101
The mouse buttons used for rectangle selection. Default is ``None``,
30943102
which corresponds to all buttons.
@@ -3169,14 +3177,18 @@ class PolygonSelector(_SelectorWidget):
31693177
backend).
31703178
31713179
props : dict, optional
3172-
Artist properties for the line representing the edges of the polygon.
3180+
Properties with which the line is drawn, see `matplotlib.lines.Line2D`
3181+
for valid properties.
31733182
Default:
3174-
dict(color='k', linestyle='-', linewidth=2, alpha=0.5)
3183+
3184+
``dict(color='k', linestyle='-', linewidth=2, alpha=0.5)``
31753185
31763186
handle_props : dict, optional
31773187
Artist properties for the markers drawn at the vertices of the polygon.
3178-
Default:
3179-
dict(marker='o', markersize=7, mec='k', mfc='k', alpha=0.5)
3188+
See the marker arguments in `matplotlib.lines.Line2D` for valid
3189+
properties. Default values are defined in ``mpl.rcParams`` except for
3190+
the default value of ``markeredgecolor`` which will be the same as the
3191+
``color`` property in *props*.
31803192
31813193
handle_grab_distance : float, default: 15px
31823194
A vertex is selected (to complete the polygon or to move a vertex) if

0 commit comments

Comments
 (0)