2016-05-10 11 views
0

mayaviのcontour3dオプションを使用して3次元データをプロットすると、3つのデフォルトの等高線がありますが、それらの間隔はどのようになっていますか?私は等高線の数を変更することができますが、ユーザー指定の値にすることができます(私は確かに可能であると推測します)。私はどのようにデフォルトの3輪郭が描かれているか知りたいです。スカラーの最大値とその分散方法に依存します。Mayavi Contour 3d

答えて

0

私はちょうど同じ問題を抱え、解決策を見つけました。輪郭の意味について今

import numpy as np 
from mayavi import mlab 
from mayavi.api import Engine 

def fun(x, y, z): 
    return np.cos(x) * np.cos(y) * np.cos(z) 

# create engine and assign figure to it 
engine = Engine() 
engine.start() 
fig = mlab.figure(figure=None, engine=engine) 
contour3d = mlab.contour3d(x, y, z, fun, figure=fig) 
scene = engine.scenes[0] 

# get a handle for the plot 
iso_surface = scene.children[0].children[0].children[0] 

# the following line will print you everything that you can modify on that object 
iso_surface.contour.print_traits() 

# now let's modify the number of contours and the min/max 
# you can also do these steps manually in the mayavi pipeline editor 
iso_surface.compute_normals = False # without this only 1 contour will be displayed 
iso_surface.contour.number_of_contours = 2 
iso_surface.contour.minimum_contour = -1.3 
iso_surface.contour.maximum_contour = 1.3 

: はここにいくつかのサンプルコードです。さて、この数字には、明らかに輪郭がいくつあるかが書かれています。次に、min/maxの値は輪郭が広がる線形空間を定義します。この値は、基本的にサーフェス法線に沿った収縮/膨張に影響します。

編集:ここにヒントがあります。プロットウィンドウが表示されたら、左上のmayaviパイプラインアイコンをクリックします。そこでは、あなたのオブジェクトを変更することができます(通常、ツリーの中で最も低い)。赤いレコードボタンを押して、変更を開始すると、対応するコード行が表示されます。

関連する問題