@@ -1921,7 +1921,11 @@ class SpanSelector(_SelectorWidget):
1921
1921
----------
1922
1922
ax : `matplotlib.axes.Axes`
1923
1923
1924
- onselect : func(min, max), min/max are floats
1924
+ onselect : callable
1925
+ A callback function to be called when the selection is completed.
1926
+ It must have the signature::
1927
+
1928
+ def on_select(min: float, max: float) -> Any
1925
1929
1926
1930
direction : {"horizontal", "vertical"}
1927
1931
The direction along which to draw the span selector.
@@ -1948,19 +1952,19 @@ class SpanSelector(_SelectorWidget):
1948
1952
Whether to draw a set of handles that allow interaction with the
1949
1953
widget after it is drawn.
1950
1954
1951
- button : `.MouseButton` or list of `.MouseButton`
1955
+ button : `.MouseButton` or list of `.MouseButton`, default: all buttons
1952
1956
The mouse buttons which activate the span selector.
1953
1957
1954
- line_props : dict, default: None
1955
- Line properties with which the interactive line are drawn . Only used
1956
- when *interactive* is True. See `matplotlib.lines.Line2D` for details
1957
- on valid properties.
1958
+ handle_props : dict, default: None
1959
+ Properties of the handle lines at the edges of the span . Only used
1960
+ when *interactive* is True. See `~ matplotlib.lines.Line2D` for valid
1961
+ properties.
1958
1962
1959
- maxdist : float, default: 10
1963
+ handle_grab_distance : float, default: 10
1960
1964
Distance in pixels within which the interactive tool handles can be
1961
1965
activated.
1962
1966
1963
- drag_from_anywhere : bool, optional
1967
+ drag_from_anywhere : bool, default: False
1964
1968
If `True`, the widget can be moved by clicking anywhere within
1965
1969
its bounds.
1966
1970
@@ -1983,7 +1987,7 @@ class SpanSelector(_SelectorWidget):
1983
1987
@_api .rename_parameter ("3.5" , "span_stays" , "interactive" )
1984
1988
def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
1985
1989
rectprops = None , onmove_callback = None , interactive = False ,
1986
- button = None , line_props = None , maxdist = 10 ,
1990
+ button = None , handle_props = None , handle_grab_distance = 10 ,
1987
1991
drag_from_anywhere = False ):
1988
1992
1989
1993
super ().__init__ (ax , onselect , useblit = useblit , button = button )
@@ -2007,7 +2011,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
2007
2011
self .onmove_callback = onmove_callback
2008
2012
self .minspan = minspan
2009
2013
2010
- self .maxdist = maxdist
2014
+ self .handle_grab_distance = handle_grab_distance
2011
2015
self ._interactive = interactive
2012
2016
self .drag_from_anywhere = drag_from_anywhere
2013
2017
@@ -2018,7 +2022,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
2018
2022
2019
2023
# Setup handles
2020
2024
props = dict (color = rectprops .get ('facecolor' , 'r' ))
2021
- props .update (cbook .normalize_kwargs (line_props , Line2D ._alias_map ))
2025
+ props .update (cbook .normalize_kwargs (handle_props , Line2D ._alias_map ))
2022
2026
2023
2027
if self ._interactive :
2024
2028
self ._edge_order = ['min' , 'max' ]
@@ -2211,7 +2215,7 @@ def _set_active_handle(self, event):
2211
2215
# Use 'C' to match the notation used in the RectangleSelector
2212
2216
if 'move' in self .state :
2213
2217
self ._active_handle = 'C'
2214
- elif e_dist > self .maxdist :
2218
+ elif e_dist > self .handle_grab_distance :
2215
2219
# Not close to any handles
2216
2220
self ._active_handle = None
2217
2221
if self .drag_from_anywhere and self ._contains (event ):
0 commit comments