I mailed this to the matplotlib-users list, but it never showed, so
I'm trying this one. Apologies
if it shows up in both places
What I'm trying to do can be boiled down to the following: I'm trying to
place a legend precisely, using the top left corner of legend as the
"sticky" point. In other words, if I want to place the legend here:
路路路
+---------------------------------+-----------+
> >
> legend |
> >
The plot... |-----------+
>
>
>
>
>
>
>
+---------------------------------+
I would have thought that I would set bbox_to_anchor = (0,0,1,1), and loc =
(1,1). I found out quickly, though, that this places the legend like this:
+-----------+
> >
> legend |
> >
+---------------------------------+-----------+
>
>
>
The plot... |
>
>
>
>
>
>
>
+---------------------------------+
Which makes perfect sense from matplotlib's perspective. So all I need to
do is figure out how tall the legend is, and subtract that off the y
coordinate before passing 'loc' off to matplotlib's legend. I just can't
seem to figure out how to get that number. I tried
self.ax.get_legend().get_frame().get_height(), but that just returns 1 all
the time. I browsed all through the legend object (a live one) and just can't
find any numbers at all that look like the legend width/height, in any
coordinate
system. I hope I'm missing something obvious!
Ascii art is fun!
--
Daniel Hyams
dhyams@...149...