title: matplotlib 2D plot from x,y,z values
body: <p>I am a Python beginner.</p>
  
  <p>I have a list of X values </p>
  
  <pre><code>x_list = [-1,2,10,3]
  </code></pre>
  
  <p>and I have a list of Y values</p>
  
  <pre><code>y_list = [3,-3,4,7]
  </code></pre>
  
  <p>I then have a Z value for each couple. Schematically, this works like that:</p>
  
  <pre><code>X   Y    Z
  -1  3    5
  2   -3   1
  10  4    2.5
  3   7    4.5
  </code></pre>
  
  <p>and the Z values are stored in <code>z_list = [5,1,2.5,4.5]</code>.
  I need to get a 2D plot with the X values on the X axis, the Y values on the Y axis, and for each couple the Z value, represented by an intensity map.
  This is what I have tried, unsuccessfully:</p>
  
  <pre><code>X, Y = np.meshgrid(x_list, y_list) 
  fig, ax = plt.subplots()
  extent = [x_list.min(), x_list.max(), y_list.min(), y_list.max()]
  im=plt.imshow(z_list, extent=extent, aspect = 'auto')
  plt.colorbar(im)
  plt.show()
  </code></pre>
  
  <p>How to get this done correctly?</p>