@@ -2238,9 +2238,8 @@ def on_select(min: float, max: float) -> Any
2238
2238
If `True`, the event triggered outside the span selector will be
2239
2239
ignored.
2240
2240
2241
- snap_values : 1D array-like, default: None
2242
- Snap the extents of the selector to the values defined in
2243
- ``snap_values``.
2241
+ snap_values : 1D array-like, optional
2242
+ Snap the selector edges to the given values.
2244
2243
2245
2244
Examples
2246
2245
--------
@@ -2585,12 +2584,11 @@ def _contains(self, event):
2585
2584
@staticmethod
2586
2585
def _snap (values , snap_values ):
2587
2586
"""Snap values to a given array values (snap_values)."""
2588
- indices = np .empty_like (values , dtype = "uint" )
2589
2587
# take into account machine precision
2590
2588
eps = np .min (np .abs (np .diff (snap_values ))) * 1e-12
2591
- for i , v in enumerate ( values ):
2592
- indices [ i ] = np .abs (snap_values - v + np .sign (v ) * eps ).argmin ()
2593
- return snap_values [ indices ]
2589
+ return tuple (
2590
+ snap_values [ np .abs (snap_values - v + np .sign (v ) * eps ).argmin ()]
2591
+ for v in values )
2594
2592
2595
2593
@property
2596
2594
def extents (self ):
@@ -2874,7 +2872,6 @@ def onselect(eclick: MouseEvent, erelease: MouseEvent)
2874
2872
use_data_coordinates : bool, default: False
2875
2873
If `True`, the "square" shape of the selector is defined in
2876
2874
data coordinates instead of display coordinates.
2877
-
2878
2875
"""
2879
2876
2880
2877
0 commit comments