PyLab - changing text color and background fill color of text box


Question

I'm using PyLab to make some graphs in Python. I want to make a text box that is colored magenta with black text, but cannot get the text to be black.

text(x, y, 'Summary', backgroundcolor = 'm', color = 'k')

This gives me a magenta background and then text that is almost just as pink. Any ideas what I'm doing wrong?

Many thanks!

1
3
3/21/2010 10:24:39 PM

it doesn't appear as though you're doing anything wrong:

In [23]: pylab.text(0.25, 0.5, 'test', backgroundcolor='m', color='r')
In [24]: pylab.text(0.5, 0.5, 'test', backgroundcolor='m', color='k')
In [25]: pylab.text(0.75, 0.5, 'test', backgroundcolor='m', color='b')

alt text http://student.physics.ucdavis.edu/~rjames/test.png

perhaps somewhere else in your code (or matplotlib installation) the mapping from strings to colors has been corrupted?

5
3/20/2010 7:06:11 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon