Skip to content

Instantly share code, notes, and snippets.

@kervel
Created April 2, 2020 14:47
Show Gist options
  • Save kervel/6f4c554a121983292f24a040d3bfd291 to your computer and use it in GitHub Desktop.
Save kervel/6f4c554a121983292f24a040d3bfd291 to your computer and use it in GitHub Desktop.
x = np.linspace(0, 2 * np.pi, 100)
fig, ax = plt.subplots()
line, = ax.plot(x, np.sin(x))
ax.grid(True)
def update(change):
line.set_ydata(np.sin(change.new * x))
fig.canvas.draw()
int_slider = widgets.IntSlider(
value=1,
min=0, max=10, step=1,
description='$\omega$',
continuous_update=False
)
int_slider.observe(update, 'value')
int_slider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment