how to center a legend

The docs
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend
suggest that
loc=(0.5,0.5)
is equivalent to
loc='center'
but it is not. How can I center the legend
relative to the x-axis?

It seems to me that I need to be able to set
not only the coordinates but also what part
of the legend box is placed at those coordinates.
(Along the lines of LaTeX box placement.)
Can I do that?

Thanks,
Alan Isaac

The docs
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend
suggest that
loc=(0.5,0.5)
is equivalent to
loc='center'
but it is not. How can I center the legend
relative to the x-axis?

As you may have noticed, loc with a tuple of two floats is interpreted
as a coordinate for the lower-left corner.

It seems to me that I need to be able to set
not only the coordinates but also what part
of the legend box is placed at those coordinates.
(Along the lines of LaTeX box placement.)
Can I do that?

You can, but with mpl from svn trunk. For example,

   legend(bbox_to_anchor=(0.5, 0.5), loc="center")

For some more details, take a look at the link below, which is my
work-in-progress legend guide.

http://dl.getdropbox.com/u/178748/mpl/legend_guid/html/legend.html#legend-location

Regards,

-JJ

ยทยทยท

On Mon, May 4, 2009 at 10:47 PM, Alan G Isaac <alan.isaac@...287...> wrote:

Thanks,
Alan Isaac

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options