@@ -1921,7 +1921,11 @@ class SpanSelector(_SelectorWidget):
19211921 ----------
19221922 ax : `matplotlib.axes.Axes`
19231923
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
19251929
19261930 direction : {"horizontal", "vertical"}
19271931 The direction along which to draw the span selector.
@@ -1948,19 +1952,19 @@ class SpanSelector(_SelectorWidget):
19481952 Whether to draw a set of handles that allow interaction with the
19491953 widget after it is drawn.
19501954
1951- button : `.MouseButton` or list of `.MouseButton`
1955+ button : `.MouseButton` or list of `.MouseButton`, default: all buttons
19521956 The mouse buttons which activate the span selector.
19531957
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.
19581962
1959- maxdist : float, default: 10
1963+ handle_grab_distance : float, default: 10
19601964 Distance in pixels within which the interactive tool handles can be
19611965 activated.
19621966
1963- drag_from_anywhere : bool, optional
1967+ drag_from_anywhere : bool, default: False
19641968 If `True`, the widget can be moved by clicking anywhere within
19651969 its bounds.
19661970
@@ -1983,7 +1987,7 @@ class SpanSelector(_SelectorWidget):
19831987 @_api .rename_parameter ("3.5" , "span_stays" , "interactive" )
19841988 def __init__ (self , ax , onselect , direction , minspan = 0 , useblit = False ,
19851989 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 ,
19871991 drag_from_anywhere = False ):
19881992
19891993 super ().__init__ (ax , onselect , useblit = useblit , button = button )
@@ -2007,7 +2011,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
20072011 self .onmove_callback = onmove_callback
20082012 self .minspan = minspan
20092013
2010- self .maxdist = maxdist
2014+ self .handle_grab_distance = handle_grab_distance
20112015 self ._interactive = interactive
20122016 self .drag_from_anywhere = drag_from_anywhere
20132017
@@ -2018,7 +2022,7 @@ def __init__(self, ax, onselect, direction, minspan=0, useblit=False,
20182022
20192023 # Setup handles
20202024 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 ))
20222026
20232027 if self ._interactive :
20242028 self ._edge_order = ['min' , 'max' ]
@@ -2211,7 +2215,7 @@ def _set_active_handle(self, event):
22112215 # Use 'C' to match the notation used in the RectangleSelector
22122216 if 'move' in self .state :
22132217 self ._active_handle = 'C'
2214- elif e_dist > self .maxdist :
2218+ elif e_dist > self .handle_grab_distance :
22152219 # Not close to any handles
22162220 self ._active_handle = None
22172221 if self .drag_from_anywhere and self ._contains (event ):
0 commit comments