ahm*_*adh 8 matplotlib color-mapping
我是matplotlib的新手,并且遇到了彩色地图.
在matplotlib中,我如何获得特定色彩图的整个RGB颜色数组,让我们说"热".例如,如果我在MATLAB中,我会这样做:
# in matlab
c = hot(256);
disp(c)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
Jou*_*nen 16
您可以通过将colormap作为函数调用来查找值,并且它接受numpy数组来一次查询多个值:
In [13]: cm.hot(arange(256))
Out[13]:
array([[ 0.0416 , 0. , 0. , 1. ],
[ 0.05189484, 0. , 0. , 1. ],
[ 0.06218969, 0. , 0. , 1. ],
...,
[ 1. , 1. , 0.96911762, 1. ],
[ 1. , 1. , 0.98455881, 1. ],
[ 1. , 1. , 1. , 1. ]])
Run Code Online (Sandbox Code Playgroud)