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

Method _stepped_value

lib/matplotlib/widgets.py:351–363  ·  view source on GitHub ↗

Return *val* coerced to closest number in the ``valstep`` grid.

(self, val)

Source from the content-addressed store, hash-verified

349 self._observers = cbook.CallbackRegistry(signals=["changed"])
350
351 def _stepped_value(self, val):
352 """Return *val* coerced to closest number in the ``valstep`` grid."""
353 if isinstance(self.valstep, Number):
354 val = (self.valmin
355 + round((val - self.valmin) / self.valstep) * self.valstep)
356 elif self.valstep is not None:
357 valstep = np.asanyarray(self.valstep)
358 if valstep.ndim != 1:
359 raise ValueError(
360 f"valstep must have 1 dimension but has {valstep.ndim}"
361 )
362 val = valstep[np.argmin(np.abs(valstep - val))]
363 return val
364
365 def disconnect(self, cid):
366 """

Callers 3

_value_in_boundsMethod · 0.80
_min_in_boundsMethod · 0.80
_max_in_boundsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected