Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. %matplotlib widget
  2. from ipywidgets import *
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5.  
  6. x = np.linspace(0, 2 * np.pi)
  7. fig = plt.figure()
  8. ax = fig.add_subplot(1, 1, 1)
  9. line, = ax.plot(x, np.sin(x))
  10.  
  11. def update(w = 1.0):
  12. line.set_ydata(np.sin(w * x))
  13. fig.canvas.draw_idle()
  14.  
  15. interact(update);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement