title: Fitting a normal curve to a histogram
body: <p>I use the following code to get two histograms from two vectors Model.1 and Model.2. I would like to have R fit a normal curve to each of the histograms.</p>
  
  <pre><code>library(ggplot2)
  
  require(ggplot2)
  require(reshape2)
  
  set.seed(1)
  df &lt;- data.frame(x&lt;-rnorm(1000,mean = 0.5, sd = 0.01),
                   y&lt;-rnorm(1000,mean = 0.5, sd = 0.01))
  df2 = melt(df)
  
  ggplot(df2, aes(value, fill = variable)) + geom_histogram(position = "dodge", binwidth=0.001,colour = "black")+    scale_fill_manual(values = c('red','blue'))+
    facet_wrap(~variable, nrow=2)+theme_bw()+ scale_x_continuous(breaks=seq(0.45,0.540,1/200))+ geom_vline(xintercept = 0.5, colour="black") + 
    stat_function(fun=dnorm) 
  </code></pre>
  
  <p>Thanks.</p>