title: Annotate ggplot plot with a multiline expression with objects?
body: <p>I would like to make an annotation on my ggplot with two lines, sub- and superscripts, and references to objects.</p>
  
  <p>I've figured out that the <code>annotate()</code> function calls <code>geom_text()</code> which when <code>parse = TRUE</code> can use expressions from <code>plotmath</code>. </p>
  
  <p>If this is my label:</p>
  
  <pre><code>q10 = 1.9
  a = 3.9
  b = -0.05
  
  lab1 = substitute(atop(paste(Q[10], '=', q10), paste(M[O[2]], '=', a, e^(b*T))), list(q10 = q10 = 1.9, a = 3.9, b = -0.05))
  </code></pre>
  
  <p>Then it will work with base plot:</p>
  
  <pre><code>plot(1, 1, main = lab1)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/L95Dr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L95Dr.png" alt="enter image description here"></a></p>
  
  <p>But when I try to use it with <code>ggplot()</code> it throws an error:</p>
  
  <pre><code>ggplot(diamonds, aes(carat, price, color = cut)) + 
    geom_point() +
    annotate(geom = 'text', x = 4, y = 5000, label = lab1, parse = TRUE, color = 'blue')
  </code></pre>
  
  <p><code>Error: Aesthetics must be either length 1 or the same as the data (1): label, colour</code></p>
  
  <p>I found questions related to multi-line annotations in ggplot: <a href="https://stackoverflow.com/questions/40577023/r-ggplot-annotated-with-atop-using-three-values-and-bgoup">R ggplot annotated with atop using three values and bgoup</a></p>
  
  <p>and related to expressions in ggplot: <a href="https://stackoverflow.com/questions/9723239/ggplot2-annotation-with-superscripts">ggplot2 annotation with superscripts</a></p>
  
  <p>But I can't figure out how to combine the appropriate answers to make a working annotation. Any help from the <code>ggplot2</code> gurus out there?</p>