Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 44b37fb

Browse files
committed
Improve docstring: add links to properties description, clarify default values.
1 parent 35ee92d commit 44b37fb

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
@@ -1893,6 +1893,7 @@ def on_select(min: float, max: float) -> Any
18931893
props : dict, optional
18941894
Dictionary of `matplotlib.patches.Patch` properties.
18951895
Default:
1896+
18961897
``dict(facecolor='red', alpha=0.5)``
18971898
18981899
onmove_callback : func(min, max), min/max are floats, default: None
@@ -1911,7 +1912,7 @@ def on_select(min: float, max: float) -> Any
19111912
19121913
handle_props : dict, default: None
19131914
Properties of the handle lines at the edges of the span. Only used
1914-
when *interactive* is True. See `~matplotlib.lines.Line2D` for valid
1915+
when *interactive* is True. See `matplotlib.lines.Line2D` for valid
19151916
properties.
19161917
19171918
handle_grab_distance : float, default: 10
@@ -2407,9 +2408,11 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
24072408
backend).
24082409
24092410
props : dict, optional
2410-
Properties with which the __ARTIST_NAME__ is drawn.
2411+
Properties with which the __ARTIST_NAME__ is drawn. See
2412+
`matplotlib.patches.Patch` for valid properties.
24112413
Default:
2412-
``dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True))``
2414+
2415+
``dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)``
24132416
24142417
spancoords : {"data", "pixels"}, default: "data"
24152418
Whether to interpret *minspanx* and *minspany* in data or in pixel
@@ -2423,7 +2426,11 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
24232426
activated.
24242427
24252428
handle_props : dict, optional
2426-
Properties with which the interactive handles are drawn.
2429+
Properties with which the interactive handles (marker artists) are
2430+
drawn. See the marker arguments in `matplotlib.lines.Line2D` for valid
2431+
properties. Default values are defined in ``mpl.rcParams`` except for
2432+
the default value of ``markeredgecolor`` which will be the same as the
2433+
``edgecolor`` property in *props*.
24272434
24282435
interactive : bool, default: False
24292436
Whether to draw a set of handles that allow interaction with the
@@ -2538,9 +2545,11 @@ def __init__(self, ax, onselect, drawtype='box',
25382545
self.handle_grab_distance = handle_grab_distance
25392546

25402547
if props is None:
2541-
_handle_props = dict(markeredgecolor='r')
2548+
_handle_props = dict(markeredgecolor='black')
25422549
else:
2543-
_handle_props = dict(markeredgecolor=props.get('edgecolor', 'r'))
2550+
_handle_props = dict(
2551+
markeredgecolor=props.get('edgecolor', 'black')
2552+
)
25442553
_handle_props.update(cbook.normalize_kwargs(handle_props,
25452554
Line2D._alias_map))
25462555
self._corner_order = ['NW', 'NE', 'SE', 'SW']
@@ -2954,9 +2963,8 @@ def onselect(verts):
29542963
Whether to use blitting for faster drawing (if supported by the
29552964
backend).
29562965
props : dict, optional
2957-
Properties with which the line is drawn.
2958-
Default:
2959-
``dict()``
2966+
Properties with which the line is drawn, see `matplotlib.lines.Line2D`
2967+
for valid properties. Default values are defined in ``mpl.rcParams``.
29602968
button : `.MouseButton` or list of `.MouseButton`, optional
29612969
The mouse buttons used for rectangle selection. Default is ``None``,
29622970
which corresponds to all buttons.
@@ -3037,14 +3045,18 @@ class PolygonSelector(_SelectorWidget):
30373045
backend).
30383046
30393047
props : dict, optional
3040-
Artist properties for the line representing the edges of the polygon.
3048+
Properties with which the line is drawn, see `matplotlib.lines.Line2D`
3049+
for valid properties.
30413050
Default:
3042-
dict(color='k', linestyle='-', linewidth=2, alpha=0.5)
3051+
3052+
``dict(color='k', linestyle='-', linewidth=2, alpha=0.5)``
30433053
30443054
handle_props : dict, optional
30453055
Artist properties for the markers drawn at the vertices of the polygon.
3046-
Default:
3047-
dict(marker='o', markersize=7, mec='k', mfc='k', alpha=0.5)
3056+
See the marker arguments in `matplotlib.lines.Line2D` for valid
3057+
properties. Default values are defined in ``mpl.rcParams`` except for
3058+
the default value of ``markeredgecolor`` which will be the same as the
3059+
``color`` property in *props*.
30483060
30493061
handle_grab_distance : float, default: 15px
30503062
A vertex is selected (to complete the polygon or to move a vertex) if

0 commit comments

Comments
 (0)