title: 2D Density Plot with X Y Z data
body: <p>I am trying to plot 2d terrain map with x,y and z (elevation). I followed the steps from the following link but I am getting very weird plot. </p>
  
  <p><a href="https://stackoverflow.com/questions/9008370/python-2d-contour-plot-from-3-lists-x-y-and-rho">Python : 2d contour plot from 3 lists : x, y and rho?</a></p>
  
  <p>I spent almost half day searching but got nowhere. </p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import matplotlib.pyplot as plt
  import scipy.interpolate
  
  # import data:
  import xlrd
  loc = "~/Desktop/Book4.xlsx"
  wb = xlrd.open_workbook(loc)
  sheet = wb.sheet_by_index(0)
  sample=500
  
  # Generate array:
  x=np.array(sheet.col_values(0))[0:sample]
  y=np.array(sheet.col_values(1))[0:sample]
  z=np.hamming(sample)[0:sample][:,None]
  
  # Set up a regular grid of interpolation points
  
  xi, yi = np.meshgrid(x, y)
  
  # Interpolate
  rbf = scipy.interpolate.Rbf(x, y, z, function='cubic')
  zi = rbf(xi, yi)
  # Plot
  plt.imshow(zi, vmin=z.min(), vmax=z.max(), origin='lower',
             extent=[x.min(), x.max(), y.min(), y.max()])
  plt.colorbar()
  plt.show()
  </code></pre>
  
  <p>The first of the following fig is what I am getting and the last one is how it should look like.
  <a href="https://i.stack.imgur.com/V8pqV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V8pqV.png" alt="This is what I am getting"></a>
  <a href="https://i.stack.imgur.com/CZTZv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CZTZv.png" alt="This is how it should look like"></a></p>
  
  <p>Any help shall be appreciated</p>
  
  <p><a href="https://drive.google.com/file/d/1HtRr21iUuYoAU-XKAWhjhFtP6EwA2Fdw/view?usp=sharing" rel="nofollow noreferrer">Link to data file</a></p>