你可以
scipy.interpolate.spline自己整理数据:
from scipy.interpolate import spline# 300 represents number of points to make between T.min and T.maxxnew = np.linspace(T.min(), T.max(), 300) power_smooth = spline(T, power, xnew)plt.plot(xnew,power_smooth)plt.show()
scipy 0.19.0中不推荐使用spline,请改用BSpline类。
从切换
spline到
BSpline复制并不是简单的复制/粘贴操作,需要进行一些调整:
from scipy.interpolate import make_interp_spline, BSpline# 300 represents number of points to make between T.min and T.maxxnew = np.linspace(T.min(), T.max(), 300) spl = make_interp_spline(T, power, k=3) # type: BSplinepower_smooth = spl(xnew)plt.plot(xnew, power_smooth)plt.show()



