%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
def plot(f1, f2):
fig, ax = plt.subplots(figsize=(4, 3),
subplot_kw={'axisbg':'#EEEEEE',
'axisbelow':True})
ax.grid(color='w', linewidth=2, linestyle='solid')
x = np.linspace(-50, 50, 1000)
ax.plot(x, np.sin(f1*x) + np.sin(f2*x), lw=5, alpha=0.4)
ax.set_xlim(-50, 50)
ax.set_ylim(-2.5, 2.5)
return fig
from ipywidgets import StaticInteract, RangeWidget, RadioWidget
StaticInteract(plot,f1=RangeWidget(1.0, 1.5, 0.1),f2=RangeWidget(1.0, 1.5, 0.1))