title: "Density" curve overlay on histogram where vertical axis is frequency (aka count) or relative frequency?
body: <p>Is there a method to overlay something analogous to a density curve when the vertical axis is frequency or relative frequency?  (Not an actual density function, since the area need not integrate to 1.)  The following question is similar:
  <a href="https://stackoverflow.com/questions/6967664/ggplot2-histogram-with-normal-curve">ggplot2: histogram with normal curve</a>, and the user self-answers with the idea to scale <code>..count..</code> inside of <code>geom_density()</code>.  However this seems unusual.  </p>
  
  <p>The following code produces an overinflated "density" line.</p>
  
  <pre><code>df1            &lt;- data.frame(v = rnorm(164, mean = 9, sd = 1.5))
  b1             &lt;- seq(4.5, 12, by = 0.1)
  hist.1a        &lt;- ggplot(df1, aes(v)) + 
                      stat_bin(aes(y = ..count..), color = "black", fill = "blue",
                               breaks = b1) + 
                      geom_density(aes(y = ..count..))
  hist.1a
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/axF8z.png" alt="plot"></p>