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

Method set_val

lib/matplotlib/widgets.py:987–1014  ·  view source on GitHub ↗

Set slider value to *val*. Parameters ---------- val : tuple or array-like of float

(self, val)

Source from the content-addressed store, hash-verified

985 self.set_val((self.val[0], max))
986
987 def set_val(self, val):
988 """
989 Set slider value to *val*.
990
991 Parameters
992 ----------
993 val : tuple or array-like of float
994 """
995 val = np.sort(val)
996 _api.check_shape((2,), val=val)
997 # Reset value to allow _value_in_bounds() to work.
998 self.val = (self.valmin, self.valmax)
999 vmin, vmax = self._value_in_bounds(val)
1000 self._update_selection_poly(vmin, vmax)
1001 if self.orientation == "vertical":
1002 self._handles[0].set_ydata([vmin])
1003 self._handles[1].set_ydata([vmax])
1004 else:
1005 self._handles[0].set_xdata([vmin])
1006 self._handles[1].set_xdata([vmax])
1007
1008 self.valtext.set_text(self._format((vmin, vmax)))
1009
1010 if self.drawon:
1011 self.ax.get_figure(root=True).canvas.draw_idle()
1012 self.val = (vmin, vmax)
1013 if self.eventson:
1014 self._observers.process("changed", (vmin, vmax))
1015
1016 def on_changed(self, func):
1017 """

Callers 4

__init__Method · 0.95
set_minMethod · 0.95
set_maxMethod · 0.95
test_range_sliderFunction · 0.95

Calls 9

_value_in_boundsMethod · 0.95
_formatMethod · 0.95
set_ydataMethod · 0.80
set_xdataMethod · 0.80
processMethod · 0.80
set_textMethod · 0.45
draw_idleMethod · 0.45
get_figureMethod · 0.45

Tested by 1

test_range_sliderFunction · 0.76