绘制平滑的曲线图

用 matplotlib 绘制

# 绘制平滑曲线
import numpy as np
from matplotlib import pyplot as plt
from scipy.interpolate import make_interp_spline

x=np.array([6, 7, 8, 9])
y=np.array([1,5,3,6])
plt.title('test')

xnew=np.linspace(x.min(),x.max(),100)
power_=make_interp_spline(x,y)(xnew)
plt.plot(xnew,power_)
plt.show()

结果图:

参考:https://blog.csdn.net/lly1122334/article/details/104252039


发表回复 0

Your email address will not be published. Required fields are marked *