title: Add ggplot annotation outside the panel? Or two titles?
body: <p>I'm making an animated plot using the <code>ggplot2</code> and <code>animation</code> packages.  Each frame of the animation consists of a map with two bits of information that I want to use as titles/labels.  </p>
  
  <p>It seems to me there are two ways of doing this.  </p>
  
  <ol>
  <li>Adjust the plot margins so there is no title margin and then use <code>geom_text</code> to add the "titles" as text annotations on the plot.  </li>
  <li>Add a second title.  (I've tried padding a single title with spaces to simulate two titles but this breaks down with repeated plots because of kerning.)</li>
  </ol>
  
  <p>The first approach isn't ideal as I need to use the same plot limits for each frame and I get these from the map extents measured in lat/long.  Determining the extra height needed for the labels results in an ugly mish-mash of units.  Adding a second title therefore seems semantically more sensible to me but after playing around with <code>annotation_custom</code>, I can't seem to figure it out.</p>
  
  <p>Here's a mock-up of what I'm after, showing the two "titles" and each with separate alignments to ensure they stay in place in repeated frames.  I've turned on the plot border to help visualize the position.  In the final plot, this would be removed.</p>
  
  <p><img src="https://i.stack.imgur.com/y3Kb1.png" alt="Mock-up of ggplot with two titles"></p>
  
  <p>Thanks for your help!</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Thanks Baptiste for the sign-posting.  I had to use slightly different arguments to (a) get the positioning right and (b) use the same font for both titles.  Here's an example:</p>
  
  <pre><code>require(gtable)
  require(ggplot2)
  
  ## Create the basic plot
  df &lt;- data.frame(x=1:10, y=1:10)
  gg &lt;- ggplot(df, aes(x,y)) + geom_point() + labs(title="Left") +
      theme(plot.title=element_text(hjust=0))
  
  ## Get the title style from the original plot
  g &lt;- ggplotGrob(gg)
  title_style &lt;- g$grobs[[8]]$gp
  
  ## Add the second title and plot
  g2 &lt;- gtable_add_grob(g, textGrob("Right", x=1, hjust=1, gp=title_style),
                        t=2, l=4, b=2, r=4, name="right-title")
  grid.draw(g2)
  </code></pre>
  
  <p>Here's the result:</p>
  
  <p><img src="https://i.stack.imgur.com/HaezD.png" alt="ggplot figure with two titles"></p>