MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _update_val_from_pos

Method _update_val_from_pos

lib/matplotlib/widgets.py:900–913  ·  view source on GitHub ↗

Update the slider value based on a given position.

(self, pos)

Source from the content-addressed store, hash-verified

898 return (self._min_in_bounds(vals[0]), self._max_in_bounds(vals[1]))
899
900 def _update_val_from_pos(self, pos):
901 """Update the slider value based on a given position."""
902 idx = np.argmin(np.abs(self.val - pos))
903 if idx == 0:
904 val = self._min_in_bounds(pos)
905 self.set_min(val)
906 else:
907 val = self._max_in_bounds(pos)
908 self.set_max(val)
909 if self._active_handle:
910 if self.orientation == "vertical":
911 self._active_handle.set_ydata([val])
912 else:
913 self._active_handle.set_xdata([val])
914
915 @_call_with_reparented_event
916 def _update(self, event):

Callers 1

_updateMethod · 0.95

Calls 6

_min_in_boundsMethod · 0.95
set_minMethod · 0.95
_max_in_boundsMethod · 0.95
set_maxMethod · 0.95
set_ydataMethod · 0.80
set_xdataMethod · 0.80

Tested by

no test coverage detected