PyLab - 更改文本框的文本颜色和背景填充颜色
我正在用PyLab在Python中画图。我想做一个背景是品红色、文字是黑色的文本框,但我就是无法把文字变成黑色。
text(x, y, 'Summary', backgroundcolor = 'm', color = 'k')
这样做之后,背景是品红色,但文字几乎和背景一样粉。请问我哪里出错了?
非常感谢!
1 个回答
5
看起来你并没有做错什么:
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')
替代文本 http://student.physics.ucdavis.edu/~rjames/test.png
也许在你代码的其他地方(或者在matplotlib的安装中),字符串和颜色之间的对应关系出了问题?