这个图例只显示了一个,是哪出问题了呀
from matplotlib import pyplot as plt
plt.rcParams['font.sans-serif']=['KaiTi']
data1=[1,2,3,5,10,12,13]
data2=[3,-1,10,12,13,9,11]
x=range(1,8)
ax1=plt.subplot()
ax2=ax1.twinx()
ax1.plot(x,data1,label='温度',color='r')
ax1.set_xlabel('时间')
ax1.set_ylabel('湿度')
ax2.set_ylabel('温度')
ax2.plot(x,data2,label='湿度',color='blue')
plt.legend()
plt.show()
