直线
for idx, (key, y) in enumerate(ylist.items()):
PF=PolynomialFeatures(degree=7)
xfit=x.reshape(-1,1)
yfit=y.reshape(-1,1)
xfit1=PF.fit_transform(xfit)
linear1=LinearRegression()
linear1.fit(xfit1,yfit)
xpre=np.linspace(0,x.shape[0]-1,num=x.shape[0],endpoint=True) #创建用于预测的x值
xpre1=PF.fit_transform(xpre[:,np.newaxis])
ypre1=linear1.predict(xpre1)
ax.plot(xpre,ypre1,"-."if "non" in key else "-",label=key,color=color[idx])
颜色
fig, ax=plt.subplots(figsize=(4,3))