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()在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

可乐加葱

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值