在mlab中反转colormap

时间:2013-02-11 20:54:30

标签: python mayavi mayavi.mlab

我只是想知道如何在mlab中反转色彩映射。我知道在matplotlib中你可以简单地将_r添加到colormap的名称来反转颜色方案。然而,它在mlab中似乎略有不同。有谁知道如何实现这一目标?

2 个答案:

答案 0 :(得分:10)

使用mayavi管道的脚本记录,我找到了:

s.module_manager.scalar_lut_manager.reverse_lut = True

答案 1 :(得分:2)

我想你想要反转一个色彩图。这对我有用(可能不是最简单的解决方案,我不是mayavi的专家),改编自here

s=mlab.surf(xx,yy,zz,colormap='GnBu')
lut = s.module_manager.scalar_lut_manager.lut.table.to_array()
ilut = lut[::-1]
# putting LUT back in the surface object
s.module_manager.scalar_lut_manager.lut.table = ilut
# forcing to update the figure once we have changed the LUT
mlab.draw()
mlab.view()
相关问题