views:

367

answers:

1

Hey all, 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!

+3  A: 

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

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

Autoplectic
The matplotlib might be corrupted. I tried running just this code: import pylab from pylab import * pylab.text(.25, .25, 'test', backgroundcolor='m', color='k') show()And still get the same behavior. Weird because I downloaded the Enthought EPD Python distro thinking it would make my life easier!
mark
@Mark: it should have, the guys over at enthought do a fantastic job. what does using other colors for the text produce (e.g. r, b as in my example)? what about different background colors?
Autoplectic