Hi Jae-Joon,

Your simpler suggestion of drawing the fig twice is just fine for my 
needs. Thank you.

JL> The exact location of the legend is known at drawing time. Thus, the
JL> location of the text needs to be calculated at the drawing. I may
JL> help you with this but it is quite tricky and you need some
JL> knowledge on internals of the mpl.
JL>
JL> Or, you may simply draw the figure twice (with same renderer), where
JL> the first one is just to calculate the location of the text.
JL> Here is an example.
JL>
JL> ------------------
JL> import matplotlib.pyplot as plt
JL> plt.plot([1, 3, 2], label="test2")
JL> l = plt.legend()
JL> plt.draw() # the location of the legend is now known
JL>
JL> ax = gca()
JL> bbox = l.legendPatch.get_bbox().inverse_transformed(ax.transAxes) #
JL> bbox in axes coordinate.
JL> x = bbox.x0+bbox.width/2. # center
JL>
JL> ax.text(x, 0, "test", va="bottom", ha="center",
JL> transform=ax.transAxes) plt.draw()
JL> ---------------------
JL>
JL> Note that if you want save the figure, you need to save it with a
JL> same dpi, or save the figure twice as above.
JL>
JL> -JJ

-- 
Christopher Brown, Ph.D.
Department of Speech and Hearing Science
Arizona State University

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to