Manually set color of points in legend

后端 未结 2 2123
不思量自难忘°
不思量自难忘° 2020-12-08 09:57

I\'m making a scatter plot which looks like this:

\"enter

(MWE at bottom of qu

2条回答
  •  旧巷少年郎
    2020-12-08 10:23

    You can obtain the legend handles and change their colors doing:

    ax = plt.gca()
    leg = ax.get_legend()
    leg.legendHandles[0].set_color('red')
    leg.legendHandles[1].set_color('yellow')
    

提交回复
热议问题