title: draping texture over a 3D surface in python
body: <p>my goal is to drap a texture (i.e. an image) over a surface and visualize it in 3D with python. The application is viewing an orthophotography over a DEM, I thence use gdal for importing my data (both image and DEM). I tried to use plot_surface from matplotlib but it seems that I can't add texture to the surface. </p>
  
  <p>here is the current code: </p>
  
  <pre><code>from osgeo import gdal
  from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  from matplotlib.gridspec import GridSpec
  import numpy as np
  
  ds = gdal.Open('MyDEM.cub')
  dem = ds.ReadAsArray()
  
  do = gdal.Open('MyOrtho.cub')
  or = do.ReadAsArray()
  
  xres = gt[1]
  yres = gt[5]
  
  X = np.arange(gt[0], gt[0] + dem.shape[1]*xres, xres)
  Y = np.linspace(gt[3], gt[3] + dem.shape[0]*yres, ds.RasterYSize)
  
  X, Y = np.meshgrid(X, Y)
  
  fig, ax = plt.subplots(figsize=(16,8), subplot_kw={'projection': '3d'})
  
  surf = ax.plot_surface(X,Y,dem,rstride=1, cstride=1,linewidth=0, antialiased=True,cmap=plt.cm.RdYlBu_r)
  
  
  fig.colorbar(surf, shrink=0.4, aspect=20)
  
  plt.show()
  </code></pre>
  
  <p>How can I use or array as a texture (e.g., or can have a different resolution/size than dem but I'll manage this later), I want first to have a stupid 3D surface with a texture. This is easy in Matlab, but how to do it with Python? Any idea ?</p>