开发者

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

How can I create a scatte开发者_运维技巧r 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 scatter plot, all I want in the legend is one example of the symbol. This plot from a previous stackoverflow post shows the kind of thing I mean:

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


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜