title: Place annotation at the top of a series of histograms in ggplot2 using a for loop
body: <p>I am creating a number of histograms and I want to add annotations towards the top of the graph.  I am plotting these using a for loop so I need a way to place the annotations at the top even though my ylims change from graph to graph.  If I could store the ylim for each graph within the loop I could cause the y coordinates for my annotation to vary based on the current graph.  The y value I include in my annotation must change dynamically as the loop proceeds across iterations.  Here is some sample code to demonstrate my issue (Notice how the annotation moves around.  I need it to change based on the ylim for each graph):</p>
  
  <pre><code>library(ggplot2)
  
  cuts &lt;- levels(as.factor(diamonds$cut))
  
  pdf(file = "Annotation Example.pdf", width = 11, height = 8,
      family = "Helvetica", bg = "white")
  
  for (i in 1:length(cuts)) {
    by.cut&lt;-subset(diamonds, diamonds$cut == cuts[[i]])
    print(ggplot(by.cut, aes(price)) +
      geom_histogram(fill = "steelblue", alpha = .55) +
    annotate ("text", label = "My annotation goes at the top", x = 10000 ,hjust = 0, y = 220, color = "darkred"))
  }    
  dev.off()
  </code></pre>