根据文档,这个应该可以工作。但事实并非如此。我可能读错了文档。有人知道怎么解决吗?
from pylab import *
N = 100
x = randn(N)
y = randn(N)
c = rand(N, 4)
plot(x, y, 'o', c=c)
IPython notebook(Python3)出现错误:
lib/python3.3/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: to_rgba: Invalid rgba arg "[[ 0.29844256 0.96853857 0.75812229 0.22794978]
[ 0.81606887 0.31641358 0.53254456 0.44198844]
[ 0.06961026 0.3265891 0.03006253 0.00485412]
[ 0.32580911 0.86645991 0.04140443 0.35550554]
在普通IPython(Python3)中出现错误:
ValueError: to_rgba: Invalid rgba arg "[[ -2.78401664e-01 -8.33924015e-01 7.54508871e-01]
[ -3.02839674e-01 -1.18292516e+00 -7.71274654e-01]
[ -3.58099013e-01 -1.18899472e+00 1.39868995e+00]
文档:
help(plot)
....
In addition, you can specify colors in many weird and
wonderful ways, including full names (``'green'``), hex
strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or
grayscale intensities as a string (``'0.8'``). Of these, the
string specifications can be used in place of a ``fmt`` group,
but the tuple forms can be used only as ``kwargs``.