What I want to do:
I want to get the position and dimensions of a text instance in matplotlib world units (not screen pixels), with the intention of calculating and preventing text overlaps.
I'm developing on Mac OSX 10.9.3, Python 2.7.5, matplotlib 1.3.1.
What I've tried:
Let t be a text instance.
t.get_window_extent(renderer):
This gets bounding box dimensions in pixels, and I need world coordinates (normalized between -1.0 and 1.0 in my case).
t._get_bbox_patch():
t = ax.text(x, y, text_string, prop_dict, bbox=dict(facecolor='red', alpha=0.5, boxstyle='square')) print t._get_bbox_patch()When I execute the above sequence, the output is
FancyBboxPatchFancyBboxPatch(0,0;1x1). In the image I produce, the text instance is rendered properly with a red bounding box, so that output leads me to think that the FancyBbox is instantiated but not actually populated with real dimensions until render time.
So, how can I get the position and dimensions of the text instance's bounding box in the same coord system units that I used for the x and y parameters I passed to ax.text(...)?
