title: Discrete data for ggplot stat_density2d
body: <p>stat_density2d seems don't like discrete data. My code following cannot be plotted, and have such errors on R 2.15.2:</p>
  
  <blockquote>
    <p>Error in contourLines(x = sort(unique(data$x)), y =
    sort(unique(data$y)),  :    no proper 'z' matrix specified In
    addition: Warning messages: 1: Removed 10000 rows containing
    non-finite values (stat_contour).  2: In min(x) : no non-missing
    arguments to min; returning Inf 3: In max(x) : no non-missing
    arguments to max; returning -Inf</p>
  </blockquote>
  
  <p>On R 2.15.3, the error is: </p>
  
  <blockquote>
    <p>Error in function (x, y, h, n = 25, lims = c(range(x), range(y)))  :<br>
    bandwidths must be strictly positive</p>
  </blockquote>
  
  <p>Probably because of the limitation n = 25.</p>
  
  <pre><code>a&lt;-url("http://www-personal.umich.edu/~ajing/Files/TestData.RData")
  load(a)
  
  library(ggplot2)
  p1&lt;-ggplot(myd, aes(x=xvar,y=yvar)) + stat_density2d(aes(fill=..level..), geom="polygon")
  gt &lt;- ggplot_gtable(ggplot_build(p1))
  </code></pre>
  
  <p>Anyway to avoid this error? Or other recommended 2D histogram plots?</p>
  
  <p>As I need two marginal histograms, ggplot is better than filled.contour for me.</p>