title: Contours of percentiles on level plot
body: <p>How can we estimate the level contours that correspond to what percentage of points lie inside the contour?</p>
  
  <p>This post describes how to add contours to a scatterplot in R:
  <br>
  <a href="https://stats.stackexchange.com/questions/31726/scatterplot-with-contour-heat-overlay">https://stats.stackexchange.com/questions/31726/scatterplot-with-contour-heat-overlay</a></p>
  
  <p>For example:</p>
  
  <pre><code>    x &lt;- rnorm(1000, 0, 1.3)
      y &lt;- rnorm(1000, 0, 1);
      dens &lt;- kde2d(x, y, n=200); ## estimate the z counts
      plot(x, y);
      contour(dens, nlevels = 5, add=T)
  </code></pre>
  
  <p><br>
  So instead of the 5 levels drawn in the above example, I would like levels that correspond to 99%, 95%, 50%, etc of points lie inside a contour line.</p>
  
  <p><br>
  <br>
  Thanks...</p>