In [1]:
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interactive
%matplotlib inline
In [2]:
def plot_func(a, f):
plt.figure(2)
x = np.linspace(0, 2*np.pi, num=1000)
y = a*np.sin(1/f*x)
plt.plot(x,y)
plt.ylim(-1.1, 1.1)
plt.title('a sin(f)')
plt.show()
interactive_plot = interactive(plot_func, a=(-1,0,0.1), f=(0.1, 1))
output = interactive_plot.children[-1]
output.layout.height = '300px'
interactive_plot
In [ ]: