The position of the legend is determined at drawing time, so it is a
bit tricky to get it right.
I recommend you to use "annotate" instead.
ax = subplot(111)
ax.plot([1,2,3], label="u=2,p=3")
leg = ax.legend()
ann = ax.annotate("Test 2", xy=(0.5, 1.), xycoords=leg.get_frame(),
xytext=(0,10), textcoords="offset points",
va="center", ha="left",
)
ann.set_zorder(leg.get_zorder()+0.1)
# the zorder of ann must be higher than leg so that the position of
leg is known when ann gets drawn
See here for some more details.
http://matplotlib.sourceforge.net/users/annotations_guide.html#using-complex-coordinate-with-annotation
Regards,
-JJ
On Fri, Mar 18, 2011 at 8:31 PM, Neal Becker <[email protected]> wrote:
> My legend is going to have a series of entries that look like:
>
> u=2,p=3
> u=1,p=4
> ...
>
>
> I want to add some (short) text that explains what u and p are.
>
> I'm thinking to get the coordinates of the legend box so I can then annotate?
>
> How would I get the coordinates of the legend box? Or is there some
> better/easier way to do what I want?
>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users