fig = pyl.figure()
pyl.title('Simplest default with labels')
ax = fig.add_subplot(221)
compute_and_plot(ax, alpha)
axcolor = 'lightgoldenrodyellow'
alpha_axis = pyl.axes([0.25, 0.15, 0.65, 0.03], axisbg=axcolor)
alpha_slider = Slider(alpha_axis, 'Amp', 0, 1, valinit=0.5)

def update(ax, val):
    alpha = alpha_slider.val
ax.cla()
compute_and_plot(ax, alpha)
pyl.draw()
alpha_slider.on_changed(lambda val: update(ax, val))
pyl.show()
Matplotlib: contour plot with slider widget