In [5]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import StaticInteract, RangeWidget, RadioWidget

h=6.6244e-34 # Planck constant in Js
c=2.998e+08     # speed of light in m/s
k=1.38e-23    #Boltzmann constant in J/K%

def bbrad(lamda, T):
    return (2*h*c*c)/(((lamda*1e-10)**5)*(np.exp(h*c/(lamda*1e-10*k*T))-1))

def plot(T):
    fig, ax = plt.subplots(figsize=(4, 3),
                           subplot_kw={'axisbg':'#EEEEEE',
                                       'axisbelow':True})
    ax.grid(color='w', linewidth=2, linestyle='solid')
    lamda = np.linspace(1000, 10000, 100)
    ax.plot(lamda, bbrad(lamda,T), lw=5, alpha=0.4)
#    ax.set_xlim(-50, 50)
#    ax.set_ylim(-2.5, 2.5)
    return fig

StaticInteract(plot,T=RangeWidget(3000., 10000., 1000.))
Out[5]:
T:
In []: