In [15]:
import numpy as np
from IPython.html import widgets
from IPython import display
import matplotlib.pyplot as plt, mpld3
%matplotlib inline 

graphChoice = widgets.Select(options=['a', 'b', 'c', 'd'])
plotBtn     = widgets.Button(description="Plot")

def PlotIt(btn):
    display.clear_output()    
    fig, ax = plt.subplots()
    x = np.linspace(-10,10,25)
    if graphChoice.value == 'a': y = np.power(x, 2)
    if graphChoice.value == 'b': y = np.power(x, 3)
    if graphChoice.value == 'c': y = -np.power(x, 2)
    if graphChoice.value == 'd': y = -np.power(x, 3)        
    ax.plot(x,y, marker='x')
    mpld3Fig = mpld3.display(fig) # Auto removes `fig`
    display.display(mpld3Fig)

plotBtn.on_click(PlotIt)
display.display(graphChoice)
display.display(plotBtn)
In [ ]: