开发者

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

开发者 https://www.devze.com 2022-12-23 20:04 出处:网络
I\'m using PyLab to make some graphs in开发者_JS百科 Python. I want to make a text box that is colored magenta with black text, but cannot get the text to be black.

I'm using PyLab to make some graphs in开发者_JS百科 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!


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号