From: Alan G Isaac <alan.isaac@gm...> - 2009-05-05 02:47:38
is equivalent to
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?
From: Jae-Joon Lee <lee.joon@gm...> - 2009-05-05 04:18:11
On Mon, May 4, 2009 at 10:47 PM, Alan G Isaac <alan.isaac@...> wrote:
> The docs
> suggest that
> is equivalent to
> 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.
> 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
From: Alan G Isaac <alan.isaac@gm...> - 2009-05-05 19:15:04
> Alan said:
>> Ideally I'd be able to do something like
On 5/5/2009 1:35 PM Jae-Joon Lee apparently wrote:
> It is quite hard to modify the order of items once the legend is created.
> Thus, I recommend you to order your items before creating the legend.
> For example,
> ax = subplot(111)
> ... plot some lines
> lines = ax.get_lines()
> labels = [l.get_label() for l in lines]
> legend(lines[::-1], labels[::-1]
> I just committed some changes to the svn which makes this kind of
> thing more handy. The legend guide is also updated with this.
Cool. Also, the way you demo above beats the
approach I took, so thanks for that too.