title: ggplot2: Set alpha=0 for certain points depending on fill value
body: <p>I'm currently working on a project that involves creating plots very similar to examples in Hadley's ggplot2 0.9.0 page regarding stat_density2d().</p>
  
  <pre><code>library(ggplot2)
  dsmall &lt;- diamonds[sample(nrow(diamonds), 1000), ]
  d &lt;- ggplot(dsmall, aes(carat, price)) + xlim(1,3)
  d + stat_density2d(geom="tile", aes(fill = ..density..), contour = FALSE)
  last_plot() + scale_fill_gradient(limits=c(1e-5,8e-4))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/NJUA9.png" alt="enter image description here"></p>
  
  <p>Now, what I am struggling with is a way to essentially turn alpha off (alpha=0) for all tiles not in the fill-range.  So every grey tile seen in the image, the alpha should be set to 0.  This would make the image a lot nicer, especially when overlaying on top of a map for example.</p>
  
  <p>If anyone has any suggestions, this would be greatly appreciated.</p>