title: geom_text() label statistics printing on top of each other in each facet of plot
body: <p>I have a faceted plot of probability distributions (histogram of y=..density.. with binwidth=1) as produced below.</p>
  
  <pre><code>library(ggplot2)
  library(sqldf)
  data(iris)
  
  #Create Binned(Factor) Versions of Continuous Variables
  iris$Sepal.Length = round(iris$Sepal.Length)
  iris$Sepal.Width &lt;- cut(iris$Sepal.Width, breaks = 4)
  
  #Plot Probability Distributions of Sepal.Lengths, Separate Plots for Each Width-bin. 
  
  p &lt;-ggplot(iris, aes(x=Sepal.Length, y=..density..)) +
    geom_histogram(binwidth=1, alpha=0.5, position = 'identity', aes(fill=Species)) +
    facet_wrap(~Sepal.Width) 
  
  p
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/O2hfe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O2hfe.png" alt="enter image description here"></a></p>
  
  <p>I would like to add a geom_text() or geom_label() for a summary stat to each facet (e.g. max(density)).</p>
  
  <p>Based on the answer <a href="https://stackoverflow.com/questions/37091322/density-histogram-in-ggplot2-label-bar-height">here</a> I tried this code, but got the plot below with each label printed on top of each other in each facet. </p>
  
  <pre><code>#Create DataFrame for Labels out of ggplot_build() data
  ggbuild &lt;- as.data.frame(ggplot_build(p)$data)
  label.data = sqldf('select PANEL, max(density) as max_density from ggbuild group by PANEL ')
  
  #Print Faceted Plot with Simple Summary Stat in Each Facet
  p + geom_text(data=label.data, aes(x=.5, y=.8, label=paste0('Max Height: ', round(max_density,2))))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/RyPwh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RyPwh.png" alt="enter image description here"></a></p>
  
  <p>Based on <a href="https://stackoverflow.com/questions/11567389/condition-a-count-summation-on-the-faceting-variable?noredirect=1&amp;lq=1">this answer</a> that "Sometimes it's easier to obtain summaries outside the call to ggplot," I tried the code below:</p>
  
  <pre><code>p + geom_text(aes(x=0, y=.8, label=label.data$max_density)) 
  </code></pre>
  
  <p>But that got me the following error:</p>
  
  <blockquote>
    <p>Error: Aesthetics must be either length 1 or the same as the data
    (100): x, y, label</p>
  </blockquote>