2017-08-25 60 views
1

我在互联网上浏览过,但我还没有找到解决方案。设置mlab表面的颜色条范围

我用mlab.pipeline.surface(mesh)绘制了同一幅图中的不同曲面。我想用相同的颜色条来绘制它们。

在该图中,曲面的右侧部分处于相同的温度,但由于每个表面的颜色条范围不同,因此颜色不同。 我认为应该有类似matplotlib.tricontourf(...,levels=...)来修复色条范围。

surfacemesh

如何设置使用mlab的彩条范围是多少?

+1

你能张贴你想达到什么样的一个简短的例子?做出潜在答案会容易得多。 Stackoverflow有一个关于它的帮助页面(https://stackoverflow.com/help/mcve) –

回答

0

您可以查看mlab的内置文档。从help(mlab.pipeline.surface)

:vmax: vmax is used to scale the colormap. 
     If None, the max of the data will be used 

:vmin: vmin is used to scale the colormap. 
     If None, the min of the data will be used 

换句话说,你需要计算每跨数据集数据的全局最小值和全局最大值,并设置相同的极值为你的每一个表面。请注意,您可以使用matplotlib的3D绘图方法完全相同(甚至完全相同的关键字)。

切向注意:您的用例也可能受益于某些透明度,因为您的曲面可能会彼此重叠,从而可能会妨碍可视化。浮现在脑海中的两个关键字opacity也许(虽然不太可能)transparent

:opacity: The overall opacity of the vtk object. Must be a float. 
      Default: 1.0 
:transparent: make the opacity of the actor depend on the 
       scalar.