title: Discretised color map with transparency in Matplotlib
body: <p>I'm looking to plot a matplotlib colormesh on top of another colormesh. The bottom plot is simply grayscale.</p>
  
  <p>The one which sits on top should however draw a transparent square when the value of the passed array is 0, and a different color for each other number in the passed array. These are 2d numpy arrays.</p>
  
  <p>Currently I have:</p>
  
  <pre><code>plt.pcolormesh(array1, vmin = -32, vmax = 32, cmap = plt.cm.binary)
  plt.pcolormesh(array2, cmap = plt.cm.spectral)
  </code></pre>
  
  <p>Obviously this doesn't produce what I'm looking for, and I assume the way to do this is to generate my own colormap, I've read this guide: <a href="http://wiki.scipy.org/Cookbook/Matplotlib/ColormapTransformations" rel="nofollow">http://wiki.scipy.org/Cookbook/Matplotlib/ColormapTransformations</a> but this doesn't seem to address transparency, nor how to make specific values map to specific colors.</p>
  
  <p>As a short example of what I'd like, an array:</p>
  
  <pre><code>[[0, 1]
   [2, 3]]
  </code></pre>
  
  <p>Should produce a grid looking like:</p>
  
  <pre><code>[[transparent, red
   [green, yellow]]
  </code></pre>
  
  <p>How do I go about doing this? Merging the arrays together isn't an option, as the bottom dataset is a height map, and the values of this will likely always span the values of the second array (these are agent IDs).</p>