Mark
Mark

Reputation: 315

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

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!

Upvotes: 3

Views: 12442

Answers (1)

Autoplectic
Autoplectic

Reputation: 7666

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?

Upvotes: 5

Related Questions