title: Smoothed 2D histogram using matplotlib and imshow
body: <p>I try to do a 2D histogram plot and to obtain a "smooth" picture by a sort of interpolation. Thus I do the following combining <code>plt.hist2d</code> and <code>plt.imshow</code></p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  data = np.loadtxt("parametre_optMC.dat", skiprows=50, usecols=(1,2))
  
  h, x, y, p = plt.hist2d(data[:,0], data[:,1], bins = 20)
  plt.imshow(h, origin = "lower", interpolation = "gaussian")
  plt.savefig("test.pdf")
  </code></pre>
  
  <p>As you can see on the picture below, the two plots are superimposed and that is the problem for which I need some help</p>
  
  <p><img src="https://i.stack.imgur.com/XBH33.png" alt="enter image description here"></p>
  
  <p>Adding clf works but I lose axes dimenions :</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  
  data = np.loadtxt("parametre_optMC.dat", skiprows=50, usecols=(1,2))
  
  h, x, y, p = plt.hist2d(data[:,0], data[:,1], bins = 20)
  plt.clf()
  plt.imshow(h, origin = "lower", interpolation = "gaussian")
  plt.savefig("test.pdf")
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/cBf6B.png" alt="enter image description here"></p>