title: How to fade color to transparent using hexbin and matplotlib?
body: <p>I am creating a "heatmap" using hexbin, and want this heatmap to be placed on top of an image. However, I would like to have the coloring of the plot fade to transparent as the frequency does (i.e. as the color fades to white, it disappears). I have tried changing the alpha value but that does not produce the desired effect. </p>
  
  <p>My code is:</p>
  
  <pre><code>n = 100000
  x = np.random.standard_normal(n)
  img = imread("soccer.jpg")
  y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
  plt.hexbin(x,y, bins='log', cmap=plt.cm.Reds, alpha = 0.3)
  plt.imshow(img,zorder=0, extent=[-10, 10, -20, 20])
  #plt.show()
  plt.savefig('map.png') 
  </code></pre>
  
  <p>I am open to using a 2d-histogram or any other plotting function. Even just being transparent when there are no values in that hexagon would be great, as many of my areas have zero data points. </p>
  
  <p>The image produced by my current code is:</p>
  
  <p><a href="https://i.stack.imgur.com/AgWah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AgWah.png" alt="Heatmap image"></a></p>