def compute_and_plot(ax, alpha):
    V, W = np.meshgrid(v, w)
Z = V ** beta * W ** (1 - beta)
X = x_bar + a + b * Z
U = alpha * np.log(V) + (1 - alpha) * np.log(X) - c * (W + V)
CS = QuadContourSet(ax, V, W, U, 200)
pyl.clabel(CS, inline=1, fontsize=10)
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: контурный график с виджетом ползунка