2014-11-08 37 views
1

一个是与柱状图图例调用,如:传说花式的传说花式的细微差别

axHistogram.legend(loc='upper left', prop={'family':'serif', 'size':'x-small'}, frameon=False) 

我们有盒子,而不是线条。

此外,在分散的传奇造型,我们有三个点的偏移:

axHistogram.legend(loc='upper left', prop={'family':'serif', 'size':'x-small'}, frameon=False) 

这里是什么,我指的是图像:

enter image description here

如何样式,这些使我有线而不是盒子,只有一个点而不是三个偏移量?

回答

2

您可以使用proxy artists创造你想要的图例项,例如从你的电话中删除label=关键字hist,并且这样做,

axHistogram.plot(np.NaN, np.NaN, label='AGN', color='b', linewidth=1) 

然后,当你创建你的传说中的条目将被一条线而不是一个盒子。

您可以使用输入选项numpointsscatterpoints来控制图例中的点数。

+1

聪明。散点图例如何? – 2014-11-08 15:54:44

+2

对'axHistogram.legend'使用'scatterpoints = 1'输入选项。 – farenorth 2014-11-08 16:42:23

+1

它已经在*答案*中。 – farenorth 2014-11-09 00:28:50