title: Converting a grayscale image to an RGB heatmap image with matplotlib
body: <p>How do I convert an M x N grayscale image, or in other words a matrix or 2-D array, into an RGB heatmap, or in other words an M x N x 3 array?</p>
  
  <p>Example:</p>
  
  <pre><code> [[0.9, 0.3], [0.2, 0.1]] 
  </code></pre>
  
  <p>should become </p>
  
  <pre><code>[[red, green-blue], [green-blue, blue]] 
  </code></pre>
  
  <p>where red is <code>[1, 0, 0]</code>, blue is <code>[0, 0, 1]</code>,etc.</p>