In [1]:
%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
In [2]:
from ipywidgets import StaticInteract, RangeWidget, RadioWidget

StaticInteract(plot,f1=RangeWidget(1.0, 1.5, 0.1),f2=RangeWidget(1.0, 1.5, 0.1))
/usr/lib/pymodules/python2.7/matplotlib/pyplot.py:412: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_num_figures`).
  max_open_warning, RuntimeWarning)

Out[2]:
f1:
f2:
In []: