如何在python中创建3D高度图

问题描述:

我有一个二维数组 Z 存储该元素位置的高度.除了使用方法 here 之外,我需要在其中创建数组 X 和Y 与 Z 大小相同,有没有更简单的方法来创建 3D 高度图?

I have a 2D array Z that stores the height at that element's position. Other than using the method here in which I need to create array X and Y with the same size as Z, are there any simpler methods to create a 3D height map?

3D 表面高度图类似于第一个表面图这里.

The 3D surface height map is something like the first surface plot here.

即使我同意其他人的meshgrids并不难,但我仍然认为Mayavi包提供了一个解决方案(检查功能 surf)

Even if I agree with the others that meshgrids are not difficult, still I think that a solution is provided by the Mayavi package (check the function surf)

from mayavi import mlabmlab.surf(Z)mlab.show()