title: Heatmap with matplotlib
body: <p>I have a set of 3-tuples, each 3-tuple consists of (var1, var2, result).
  Example of a list of 9 3-tuples: </p>
  
  <pre><code>&lt;type 'list'&gt;: 
  [(4, 0.7, 0.8530612244898, 0.016579670213527985), 
   (4, 0.6, 0.8730158730157779, 0.011562402525241757), 
   (6, 0.8, 0.8378684807257778, 0.018175985875060037), 
   (4, 0.8, 0.8605442176870833, 0.015586992159716321), 
   (2, 0.8, 0.8537414965986667, 0.0034013605443334316), 
   (2, 0.7, 0.843537414966, 0.006802721088333352), 
   (6, 0.6, 0.8480725623582223, 0.01696896774039503), 
   (2, 0.6, 0.84693877551025, 0.010204081632749995), 
   (6, 0.7, 0.8577097505669444, 0.019873637350220318)]
  </code></pre>
  
  <p>Now I'd like to create a heatmap out of this.
  <code>Var1</code> can be values <code>[2,4,6]</code> and <code>Var2</code> can be <code>[0.6, 0.7, 0.8]</code>. There's a total of 9 results. </p>
  
  <p>This is the code I use to plot a heatmap:</p>
  
  <pre><code>    # list of 3-tuples to 3 lists: x, y and weights
      # x (var1) = [2,4,6]
      # y (var2) = [0.6, 0.7, 0.8]
      # weights (res) = [....] (9 values)
  
      x, y = np.meshgrid(x, y)
      intensity = np.array(weights)
  
      plt.pcolormesh(x, y, intensity)
      plt.colorbar()  # need a colorbar to show the intensity scale
      plt.show()
  </code></pre>
  
  <p>Which leads to this graph:
  <a href="https://i.stack.imgur.com/LKhlR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LKhlR.png" alt="enter image description here"></a></p>
  
  <p>What I find weird is that there's only 4 sections, but I expected there to be 9 (3x3). Can someone shed some light on what I did wrong here?</p>