栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python画图(双y4线)

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python画图(双y4线)

python画图(双y4线)

font1 = {“family” : “Times New Roman”,“weight” : “normal”,“size” : 25,} #设置字体
plt.xlabel(‘Transfer learning data number’,font1)
plt.xticks(fontsize=20)#字体
plt.xticks([0, 1, 2, 3, 4, 5,6,7,8,9,10])#x轴的范围
plt.yticks(fontsize=20)
plt.ylabel(‘MSE(2,3,4)’,font1)
#plt.plot(x0, y_test)
#line2, = ax.plot(x1,mse2, c=‘r’, label=‘Second transfer’)
line2, = ax.plot(x1,mse2, c=‘r’, label=‘2th transfer’,linewidth=3)
plt.scatter(x1, mse2,color=‘r’)
line3, = ax.plot(x1,mse3, c=‘blue’, label=‘3th transfer’,linewidth=3)
plt.scatter(x1, mse3,color=‘blue’)
line4, = ax.plot(x1,mse4, c=‘g’, label=‘4th transfer’,linewidth=3)
plt.scatter(x1, mse4,color=‘g’)
#*plt.plot(x1,mse1, color=‘red’)
#plt.scatter(x1, mse1,color=‘red’)

plt.plot(x1,mse2, color=‘blue’)#scater画点图 plt.scatter(x1, mse2,color=‘blue’) plt.plot(x1,mse3, color=‘green’) plt.scatter(x1, mse3,color=‘green’) plt.plot(x1,mse4, color=‘black’) plt.scatter(x1, mse4,color=‘black’)

#plt.scatter(x0.numpy(), predict, color=‘red’, label=‘Predicted temperature value’)
ax1 = ax.twinx()#复制x轴
plt.yticks(fontsize=20)
plt.ylabel(‘MSE(1)’,font1)
line1, = ax1.plot(x1,mse1, c=‘orange’, label=‘1th transfer’,linewidth=3)
plt.scatter(x1, mse1,color=‘orange’)

###设置坐标轴的粗细
ax=plt.gca();#获得坐标轴的句柄
ax.spines[‘bottom’].set_linewidth(4);###设置底部坐标轴的粗细
ax.spines[‘left’].set_linewidth(4);####设置左边坐标轴的粗细
ax.spines[‘right’].set_linewidth(4);###设置右边坐标轴的粗细
ax.spines[‘top’].set_linewidth(4);####设置上部坐标轴的粗细

plt.legend(handles=[line1, line2,line3,line4], labels=[‘1th transfer’, ‘2th transfer’,‘3th transfer’,‘4th transfer’],loc=9)#展示标签
#plt.legend(loc=‘center’)
plt.show()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/325735.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号