【发布时间】:2011-12-20 19:07:54
【问题描述】:
我想得到这样的密度分布图density http://www.nicolacarlon.it/out.png 使用 alpha 通道而不是像这样的蓝色通道 density http://www.nicolacarlon.it/out2.png
我找到了这段代码,但它不起作用:(
theCM = cm.get_cmap()
theCM._init()
alphas = np.abs(np.linspace(-1.0, 1.0, theCM.N))
theCM._lut[:-3,-1] = alphas
plt.imshow(img, cmap=theCM)
plt.savefig("out.svg", transparent=True)
【问题讨论】:
-
'out.svg' 产生什么?它有什么问题?
-
制作第一张图片。
-
如果我写 theCM=cm.get_cmap('hvs') 我会得到一个具有正常 hvs 颜色图的图像:(
-
0.99.3-1ubuntu1(使用 apt-get python-matplotlib)
-
如果我注释代码的第 3 行和第 4 行,我会得到相同的结果...
标签: python numpy matplotlib color-mapping