import numpy as np
import matplotlib.pyplot as plt
# 生成一些示例数据
x = np.arange(10,60,10)
y1 = [0.677,0.687,0.683,0.604,0.683]
y2 = [0.9500,0.928,0.931,0.928,0.938]
# 创建一个图形和两个y轴
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
#绘制折线图
line1 = ax1.plot(x, y1,label='MAS', color='r', marker='o', ls='-')
line2 = ax2.plot(x, y2, label='RMSE', color='b', marker='s', ls='-')
lines = line1 + line2
labels = [h.get_label() for h in lines]
plt.legend(lines, labels, loc='upper right')
# 设置x轴和y轴的标签,指明坐标含义
ax1.set_ylabel('MAS',fontdict={'size': 16})
#设置刻标
ax1.set_xticks(np.arange(10,60,10))
ax1.set_yticks(np.arange(0.670, 0.690, 0.005))
ax2.set_yticks(np.arange(0.920, 0.950, 0.005))
# 设置中文显示
plt.rcParams['font.sans-serif']=['SimHei']
#展示图片
plt.show()