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...