私信  •  关注

ascripter

ascripter 最近创建的主题
ascripter 最近回复了

看看可能的签名 legend() ,即。 legend(handles, labels) .

它在 Legend Tutorial

line1,  = plt.plot([0,1],[0,1],'g',label='Solid')
line2,  = plt.plot([0,1],[.5,1],'b',label='Solid')
plt.plot([0,1],[1,0],'g--',label='Dashed')
plt.plot([0,1],[.5,0],'b--',label='Dashed')
plt.legend((line1, line2), ('green', 'blue'))
plt.show()

Output Image