当你画图想把不同的标签放在一个子图里时:
l1 = ax1.plot(b0[0:102],df.iloc[:,0:102],'g--',label='dN')
l2 = ax1.plot(b0[102:153],df.iloc[:,102:153],'b--',label='dV')
ax1.legend(handles=[l1,l2],fontsize=fts,loc='lower center',ncol=1)
结果出现:'list' object has no attribute 'get_label'
解决办法为:
l1, = ax1.plot(b0[0:102],df.iloc[:,0:102],'g--',label='dN')
l2, = ax1.plot(b0[102:153],df.iloc[:,102:153],'b--',label='dV')
ax1.legend(handles=[l1,l2],fontsize=fts,loc='lower center',ncol=1)
加上一个逗号就好了。