这是要查看的复杂数据,所以我认为您需要一个工具来简化查看3D数据,而MayaVi是一个很好的选择。
举个例子
这其中最重要的一点是它具有高度的交互性,所以使用鼠标我可以很容易地抓取和移动切片平面。甚至倾斜它们来探索数据体数据(这是非常有用的,在本例中我们可以看到它的内部大部分是红色的,这是我们不能仅仅从表面猜到的):
下面是代码,它只是this的一个稍微修改的版本:from mayavi import mlab
import numpy as np
x, y, z = np.ogrid[-2:2:20j, -2:2:20j, -2:2:20j]
s = np.sin(x*y*z + x + y*z)/(x*y*z + x + y*z)
mlab.pipeline.image_plane_widget(mlab.pipeline.scalar_field(s),
plane_orientation='x_axes',
slice_index=20,
)
mlab.pipeline.image_plane_widget(mlab.pipeline.scalar_field(s),
plane_orientation='y_axes',
slice_index=20,
)
mlab.pipeline.image_plane_widget(mlab.pipeline.scalar_field(s),
plane_orientation='z_axes',
slice_index=20,
)
mlab.outline()
mlab.show()