On 3/16/10 10:10 AM, PaterMaximus wrote:
I have I have an image with both light and dark regions. I want to write text on it in a color that contrasts with the underlying image color.Right now if I make the text black, it is not very legible if the underling color is dark. Similarly, if I make the text white, it is not legible if the underlying color is light. (using gray text will not work) One way to solve the problem would be to: -produce the image e.g. im1=plt.imshow (zM,origin='lower',interpolation='hanning',extent=None) -get the underlying color from the image where I want to place the text Need help here. How do I get the color from im1 -calculate a contrasting color Need help here -plot the text in the contrasting color Another way would be to use a font with a dark edge and light interior (or vice versa) but I know of know such font for matplotlib. Any help appreciated...
You could put your text inside a colored box - see e.g. http://matplotlib.sourceforge.net/users/text_intro.html <http://matplotlib.sourceforge.net/users/text_intro.html?highlight=text%20box>
-Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : jeffrey.s.whita...@noaa.gov 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users