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

Method __init__

lib/matplotlib/widgets.py:311–349  ·  view source on GitHub ↗
(self, ax, orientation, closedmin, closedmax,
                 valmin, valmax, valfmt, dragging, valstep)

Source from the content-addressed store, hash-verified

309 For the slider to remain responsive you must maintain a reference to it.
310 """
311 def __init__(self, ax, orientation, closedmin, closedmax,
312 valmin, valmax, valfmt, dragging, valstep):
313 if ax.name == '3d':
314 raise ValueError('Sliders cannot be added to 3D Axes')
315
316 super().__init__(ax)
317 _api.check_in_list(['horizontal', 'vertical'], orientation=orientation)
318
319 self.orientation = orientation
320 self.closedmin = closedmin
321 self.closedmax = closedmax
322 self.valmin = valmin
323 self.valmax = valmax
324 self.valstep = valstep
325 self.drag_active = False
326 self.valfmt = valfmt
327
328 if orientation == "vertical":
329 ax.set_ylim(valmin, valmax)
330 axis = ax.yaxis
331 else:
332 ax.set_xlim(valmin, valmax)
333 axis = ax.xaxis
334
335 self._fmt = axis.get_major_formatter()
336 if not isinstance(self._fmt, ticker.ScalarFormatter):
337 self._fmt = ticker.ScalarFormatter()
338 self._fmt.set_axis(axis)
339 self._fmt.set_useOffset(False) # No additive offset.
340 self._fmt.set_useMathText(True) # x sign before multiplicative offset.
341
342 ax.set_axis_off()
343 ax.set_navigate(False)
344
345 self.connect_event("button_press_event", self._update)
346 self.connect_event("button_release_event", self._update)
347 if dragging:
348 self.connect_event("motion_notify_event", self._update)
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."""

Callers

nothing calls this directly

Calls 10

get_major_formatterMethod · 0.80
set_useOffsetMethod · 0.80
set_useMathTextMethod · 0.80
set_navigateMethod · 0.80
connect_eventMethod · 0.80
__init__Method · 0.45
set_ylimMethod · 0.45
set_xlimMethod · 0.45
set_axisMethod · 0.45
set_axis_offMethod · 0.45

Tested by

no test coverage detected