I would like to ask if there is a way to print only the legend box of a figure.
The motiviation for wanting to do this is a work around to the problem of
having the legend box obscuring data without resorting to "outside" placement
of the legend. The idea here is that matplotlib would pr
Hi Peter,
just get the legend handlers and labels with
handles,labels = ax.get_legend_handles_labels()
then create an empty plot with axes `axe` and do
axe.legend(handles, labels, loc=loc)
If you want to hide the axis:
axe.xaxis.set_visible(False)
axe.yaxis.set_visible(False)
> 1. PNG file of figure without legend.
> 2. PNG file of legend only.
>
> The end user would import both images into another tool (e.g. microsoft
> power point) and arrange figure and legend interactively for the final
> product.
As someone pointed out to me not long ago, you can call
my_lege
I would also like to point out that you can specify "auto" for a location,
and matplotlib will attempt to find a good location for you (within the
plot area). It isn't perfect, but it can be useful.
Cheers!
Ben Root
On Fri, Jan 31, 2014 at 7:02 AM, Skip Montanaro wrote:
> > 1. PNG file of figu
Is it legend(loc='auto') or legend(loc='best')? I always used the latter. I
think that http://matplotlib.org/api/legend_api.html supports me here.
-Sterling
On Jan 31, 2014, at 8:31AM, Benjamin Root wrote:
> I would also like to point out that you can specify "auto" for a location,
> and ma