import scipy.interpolate as sp
%pylab inline
Populating the interactive namespace from numpy and matplotlib
xx = numpy.linspace(0, 10, 50)
yy = numpy.sin(xx)
x = numpy.linspace(0, 10, 10)
y = numpy.sin(x)
fl = sp.interp1d(x, y,kind='linear')
fc = sp.interp1d(x, y,kind='cubic')
xnew = numpy.linspace(0, 10, 50)
pylab.subplot(211)
<matplotlib.axes.AxesSubplot at 0x10a3e1090>
pylab.plot(xx, yy)
pylab.legend(['sin(x)'], loc='best')
pylab.subplot(212)
<matplotlib.axes.AxesSubplot at 0x109628450>
pylab.plot(x, y, 'o', xnew, fl(xnew), xnew, fc(xnew))
pylab.legend(['sample', 'linear', 'cubic'], loc='lower left')
<matplotlib.legend.Legend at 0x10a34cc10>