Le , Jae-Joon Lee <lee.j.j...@gmail.com> a écrit :
On Sun, Jan 30, 2011 at 10:32 PM, Peter Butterworth butt...@gmail.com> wrote:
> here are some observations on the mpl legend operation:

> leg = ax.get_legend() #0 OK. but the recommended way to update a
> legend seems to be using #1 ?
> leg = ax.legend() #1 OK
> leg.draggable(True) #3 enables the legend to be moved with mouse.
> New in mpl1.0.1. OK
> leg.set_visible(False) #4 hides legend. OK

> ax.legend(loc=3) #2 defines a legend location. OK but why no
> locations outside the plotting area ?
Legend can be located outside the plotting area, anywhere you want.
http://matplotlib.sourceforge.net/users/legend_guide.html#legend-location

Good to know.It is a bit more complex than a legend inside the axes though as you need to setup a bbox.

btw, there's a typo in the html page: should be bbox_transform instead of transform in the doc: "For example, if you want your axes legend located at the figure corner (instead of the axes corner):
l = legend(bbox_to_anchor=(0, 0, 1, 1), transform=gcf().transFigure)"


> ax.legend(ax.lines) #5 labels are different by default from #1. ??
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend
If there is a single non-keyword argument, it is treated as a list of labels.

meaning that you always have to fully specify the labels.

> ax.legend([]) #6 draws an empty square. ??
To me, the current behavior seems reasonable. What do you expect?

An empty square isn't terribly useful and will likely need to be hidden. Could this form be used as to simply get rid of the legend instead ?
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to