GCien
GCien

Reputation: 2349

Legend stylings

One on the nuances of legend stylings is that with the histogram legend call, such as:

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

We have boxes rather than lines.

Also, with the scatter legend styling, we have three dots offset:

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

Here is a image of what I mean:

enter image description here

How do I style these so that I have lines rather than boxes and just one dot rather than three offset?

Upvotes: 0

Views: 93

Answers (1)

farenorth
farenorth

Reputation: 10771

You can use proxy artists to create the legend entries you want, for example remove the label= keyword from your call to hist, and do something like,

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

Then when you create your legend the entry will be a line rather than a box.

You can use the numpoints and scatterpoints input option to legend to control the number of points that are in the legend.

Upvotes: 1

Related Questions