some explanatory text with legend

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?

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 <ndbecker2@...287...> 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
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options