ore_event_outside=True``. Parameters ---------- ax : `matplotlib.axes.Axes` onselect : callable A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:: def on_select(min: float, max: float) -> Any direction : {"horizontal", "vertical"} The direction along which to draw the span selector. minspan : float, default: 0 If selection is less than or equal to *minspan*, the selection is removed (when already existing) or cancelled. useblit : bool, default: False If True, use the backend-dependent blitting features for faster canvas updates. See the tutorial :doc:`/tutorials/advanced/blitting` for details. props : dict, optional Dictionary of `matplotlib.patches.Patch` properties. Default: ``dict(facecolor='red', alpha=0.5)`` onmove_callback : func(min, max), min/max are floats, default: None Called on mouse move while the span is being selected. span_stays : bool, default: False If True, the span stays visible after the mouse is released. Deprecated, use *interactive* instead. interactive : bool, default: False Whether to draw a set of handles that allow interaction with the widget after it is drawn. button : `.MouseButton` or list of `.MouseButton`, default: all buttons The mouse buttons which activate the span selector. handle_props : dict, default: None Properties of the handle lines at the edges of the span. Only used when *interactive* is True. See `matplotlib.lines.Line2D` for valid properties. grab_range : float, default: 10 Distance in pixels within which the interactive tool handles can be activated. state_modifier_keys : dict, optional Keyboard modifiers which affect the widget's behavior. Values amend the defaults, which are: - "clear": Clear the current shape, default: "escape". drag_from_anywhere : bool, default: False If `True`, the widget can be moved by clicking anywhere within its bounds. ignore_event_outside : bool, default: False If `True`, the event triggered outside the span selector will be ignored. snap_values : 1D array-like, optional Snap the selector edges to the given values. Examples -------- >>> import matplotlib.pyplot as plt >>> import matplotlib.widgets as mwidgets >>> fig, ax = plt.subplots() >>> ax.plot([1, 2, 3], [10, 50, 100]) >>> def onselect(vmin, vmax): ... print(vmin, vmax) >>> span = mwidgets.SpanSelector(ax, onselect, 'horizontal', ... props=dict(facecolor='blue', alpha=0.5)) >>> fig.show() See also: :doc:`/gallery/widgets/span_selector` rĪ