Draw a terrain with python?
Question: I have a numpy 2d-array representing the geometrical height of a specific area
where a street will be build. I can visualize this using `scipy.misc.toimage`.
However I would like to get a simple 3D view of the area. Is there a simple
way to plot or render this data as an 3d-image?


Answer: Perhaps use matplotlib's
[plot_surface](http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#surface-
plots) or
[plot_wireframe](http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html#wireframe-
plots):

    
    
    import matplotlib.pyplot as plt
    import numpy as np
    import mpl_toolkits.mplot3d.axes3d as axes3d
    
    np.random.seed(1)
    fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
    N = 100
    X, Y = np.meshgrid(np.arange(N), np.arange(N))
    heights = np.sin(2*np.pi*np.sqrt(X**2+Y**2)/N)
    ax.plot_surface(X, Y, heights, cmap=plt.get_cmap('jet'))
    plt.show()
    

![enter image description here](http://i.stack.imgur.com/Ivf1y.png)

These functions require three 2D-arrays: X, Y, Z. You have the heights, `Z`.
To generate the standard `X` and `Y` locations associated with those `Z`s, you
could use `np.meshgrid`.

