getting text size _before_ plotting

All: I'm trying to make a map (using Basemap), and plot names of cities on that map. I'd like to avoid "collisions" of city names (where the bounding boxes of the text objects would overlap), but I'm having trouble figuring out how I can do this without actually drawing the text on the figure.

I found this thread:

http://osdir.com/ml/python.matplotlib.general/2005-02/msg00174.html

which describes how to do it _after_ drawing the text on the plot. This would only be useful to me if there were some way to un-draw the text, which isn't something I know how to do either.

Figure resizing is not a problem for my application.

Java has a FontMetrics class, which tells you how big a string will be in a given font - is there an equivalent for Matplotlib?

--Mike

Michael Hearne wrote:

All: I'm trying to make a map (using Basemap), and plot names of cities on that map. I'd like to avoid "collisions" of city names (where the bounding boxes of the text objects would overlap), but I'm having trouble figuring out how I can do this without actually drawing the text on the figure.

I found this thread:

http://osdir.com/ml/python.matplotlib.general/2005-02/msg00174.html

which describes how to do it _after_ drawing the text on the plot. This would only be useful to me if there were some way to un-draw the text, which isn't something I know how to do either.
  
Michael: Each Text instance that you add to the plot has a remove method that you can call to 'undraw' it.

-Jeff

···

Figure resizing is not a problem for my application.

Java has a FontMetrics class, which tells you how big a string will be in a given font - is there an equivalent for Matplotlib?

--Mike

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
  
--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg