我想出了一个可行的解决方案!有没有比这更好的方法了?
fig1.suptitle('Test')ax1 = fig1.add_subplot(221)ax1.plot(x,y1,color='b',label='aVal')ax2 = ax1.twinx()ax2.plot(x,y2,color='g',label='bVal')ax2.grid( ls='--', color='black')h1, l1 = ax1.get_legend_handles_labels()h2, l2 = ax2.get_legend_handles_labels()ax1.legend(h1+h2, l1+l2, loc=2)


