画图中两个图例放在一个图里

bb=[mpatches.Patch(color=color1[j], label="{:s}".format(label1[j]), alpha=alpha1[j]) for j in range(len(label1))]

aa = [mpatches.Patch(color=color[i], label="{:s}".format(labels[i]), alpha=alpha[i]) for i in range(len(labels))]
#plt.plot(linestyle='-', label='女生购物欲望')
#ax=plt.gca().add_artist(bb)
newlegend=[]
cc=plt.legend(['Cos(X)', "Sin(X)"])

plt.legend(handles=aa,fontsize="15")

plt.gca().add_artist(cc)

猜你喜欢

转载自blog.csdn.net/zhuiyunzhugang/article/details/117604889