Search code examples
pythonmatplotlibsurfacemayavi.mlabmatplotlib-3d

how to create a 3D height map


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?

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


Solution

  • 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 mlab mlab.surf(Z) mlab.show()