matplotlib设置同一个图中不同y轴刻度:
设置x轴相同,不同的y轴刻度:
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(plot_loss, 'r-',label='smoothL1 loss')
ax1.plot(plot_dis, 'b-', label='L1 Distance')
ax1.legend(loc='upper right')
ax2 = ax1.twinx()
ax2.plot(plot_lr, 'k-',label='lr')
ax2.legend(loc='upper right')
fig.savefig(log_dir.replace('.txt','.png'), dpi=1000)
结果: