How to create a scatter plot legend with only one symbol for each label?

前端 未结 1 517
死守一世寂寞
死守一世寂寞 2020-12-14 15:17

How can I create a scatter plot legend without two symbols showing up each time? I can understand why you\'d want this when you\'re joining symbols by lines, but for a pure

相关标签:
1条回答
  • 2020-12-14 15:42

    In the legend command you can use the scatterpoints option:

    ax.legend(loc=0, scatterpoints = 1)
    

    For a normal plot, it is the option numpoints.

    Here you can find more information about the keyword arguments for the legend: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend

    0 讨论(0)
提交回复
热议问题