1

我有位于极坐标点网格上的标量值。虽然我可以自由选择 theta 和 phi 角度,但 r 值是由我的数据评估中的另一个步骤给出的。如何使用 mayavi 绘制等值面和一些切割数据?

此刻,我正在尝试使用 scipy.interpolate.griddata 来获取欧几里德网格,但它已经工作了几个小时而没有结果......

from scipy import *
from enthought.mayavi import mlab

r_val = [0.5, 1.0, 1.5, 2.0] # externally given
r, theta, phi = mgrid[ \
        r_val[0]:r_val[-1]:len(r_val)*1.j, \
        0:pi:len(r_val)*1.j, \
        0:2.*pi:len(r_val)*1.j ]
x = r*sin(theta)*cos(phi)
y = r*sin(theta)*sin(phi)
z = r*cos(theta)
# here would be the data
s = ones_like(x)
s *= r*r
# the x,y,z axes of this plot are r,theta,phi
mlab.contour3d(s)
# but I want them to be x,y,z!
# this does not work
#mlab.contour3d(x,y,z,s)
4

1 回答 1

0

http://permalink.gmane.org/gmane.comp.python.enthought.devel/20667

src = mlab.pipeline.scalar_scatter(x,y,z,s)
iso=mlab.pipeline.iso_surface(gs)
于 2012-11-29T22:20:19.190 回答