title: Overlay histogram with density curve
body: <p>I am trying to make a histogram of density values and overlay that with the curve of a density function (not the density estimate).</p>
  
  <p>Using a simple standard normal example, here is some data:</p>
  
  <pre><code>x &lt;- rnorm(1000)
  </code></pre>
  
  <p>I can do:</p>
  
  <pre><code>q &lt;- qplot( x, geom="histogram")
  q + stat_function( fun = dnorm )
  </code></pre>
  
  <p>but this gives the scale of the histogram in frequencies and not densities. with <code>..density..</code> I can get the proper scale on the histogram:</p>
  
  <pre><code>q &lt;- qplot( x,..density.., geom="histogram")
  q
  </code></pre>
  
  <p>But now this gives an error:</p>
  
  <pre><code>q + stat_function( fun = dnorm )
  </code></pre>
  
  <p>Is there something I am not seeing?</p>
  
  <p>Another question, is there a way to plot the curve of a function, like <code>curve()</code>, but then not as layer?</p>