I need to make a smooth line in python using cubic spline, I followed the scipy tutorial and got a little confused. I used the following code:
import matplotlib.pyplot as plt
from scipy import interpolate
tck = interpolate.splrep(time, ca40Mass)
plt.semilogy(time,ca40Mass,label='$^{40}$Ca')
plt.xlabel('time [s]')
plt.ylabel('fallback mass [$M_\odot$]')
plt.xlim(20,60)
plt.ylim(1.0e-3, 2.0e-1)
plt.legend(loc=3)
and my plot still didn't smooth out, maybe I missed something, please help me fix this. My plot output is this:
You are not using the interpolation.
time_spline = numpy.linspace(min(time),max(time),1000)
ca40Mass_spline = interpolate.splev(time_spline, tck)
plt.semilogy(time_spline, ca40Mass_spline, label='$^{40}$Ca')