title: Contourf on the faces of a Matplotlib cube
body: <p>I am trying to 'paint' the faces of a cube with a contourf function using Python Matplotlib. Is this possible? </p>
  
  <p>This is similar idea to what was done <a href="https://stackoverflow.com/questions/18853563/how-can-i-paint-the-faces-of-a-cube">here</a> but obviously I cannot use patches. Similarly, I don't think I can use add_collection3d <a href="https://stackoverflow.com/questions/6159437/basemap-on-the-face-of-a-matplotlib-mplot3d-cube">like this</a> as it only supports PolyCollection, LineColleciton and PatchCollection.</p>
  
  <p>I have been trying to use contourf on a <code>fig.gca(projection='3d')</code>. Toy example below.</p>
  
  <pre><code>from mpl_toolkits.mplot3d import Axes3D
  import matplotlib.pyplot as plt
  import numpy as np
  
  plt.close('all')
  fig = plt.figure()
  ax = fig.gca(projection='3d')
  
  ############################################
  #  plotting the 'top' layer works okay...  #
  ############################################
  
  X = np.linspace(-5, 5, 43)
  Y = np.linspace(-5, 5, 28)
  X, Y = np.meshgrid(X, Y)
  
  varone=np.random.rand(75,28,43)
  Z=varone[0,:,:]
  cset = ax.contourf(X, Y, Z, zdir='z', offset=1,
                  levels=np.linspace(np.min(Z),np.max(Z),30),cmap='jet')
  #see [1]
  plt.show()
  
  #################################################
  #  but now trying to plot a vertical slice....  #
  #################################################
  
  plt.close('all')
  fig = plt.figure()
  ax = fig.gca(projection='3d')
  
  Z=varone[::-1,:,-1]
  X = np.linspace(-5, 5, 28)
  Y = np.linspace(-5, 5, 75)
  X, Y = np.meshgrid(X, Y)
  
  #this 'projection' doesn't result in what I want, I really just want to rotate it
  cset = ax.contourf(X, Y, Z, offset=5,zdir='x',
                  levels=np.linspace(np.min(Z),np.max(Z),30),cmap='jet')
  
  #here's what it should look like....
  ax=fig.add_subplot(1, 2,1)
  cs1=ax.contourf(X,Y,Z,levels=np.linspace(np.min(Z),np.max(Z),30),cmap='jet')
  #see [2]    
  plt.show()
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/18853563/how-can-i-paint-the-faces-of-a-cube">1</a> From the example, the top surface comes easily:<br>
  <a href="https://i.stack.imgur.com/pkL0Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pkL0Y.png" alt="example plot #1"></a></p>
  
  <p><a href="https://stackoverflow.com/questions/6159437/basemap-on-the-face-of-a-matplotlib-mplot3d-cube">2</a> But I'm not sure how to do the sides. Left side of this plot is what the section should look like (but rotated)...<br>
  <a href="https://i.stack.imgur.com/J6muf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/J6muf.png" alt="example plot #2"></a></p>
  
  <p>Open to other python approaches. The data I'm actually plotting are geophysical netcdf files.</p>