我了解如何在 mayavi 中绘制数据网格的轮廓,如下所示:
from mayavi import mlab
mlab.contour3d(my_data_grid)
但是,我很好奇该函数的其他签名是什么:
mlab.contour3d(x, y, z, my_data_grid)
docs说:
If 4 arrays, (x, y, z, scalars) are passed, the 3 first arrays give the position of the arrows, and the last the scalar value.
什么是“箭头”?我还没有找到任何示例,当我尝试用我的数据集调用它时出现段错误,因此无法测试。
编辑:现在我明白了 mlab 期望 x、y 和 z 的格式,并且我能够让它工作。然而,并没有箭矢!我假设这是文档中的错误...
最佳答案
与其说是文档中的错误,不如说是描述功能的一种看似别扭的方式。来自同一个文档,contour3d
:
Plots iso-surfaces for a 3D volume of data supplied as arguments
据说(加粗我的):
The x, y and z arrays are then supposed to have been generated by numpy.mgrid, in other words, they are 3D arrays, with positions lying on a 3D orthogonal and regularly spaced grid with nearest neighbor in space matching nearest neighbor in the array. The function builds a scalar field assuming the points are regularly spaced.
“箭头”似乎有点笨拙,表示 x
、y
和 z
是 `
3D arrays, with positions lying on a 3D orthogonal and regularly spaced grid
具有“构建标量场”作为等值面的功能,有效地“连接点(位置)”。
关于python - Mayavi contour3d 文档提到 "the arrows"时是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31596024/