title: How do I add an exponential trendline to various scatter plots in ggplot2?
body: <p>first time posting a question in here.</p>
  <p>I can't seem to find an easy way to add an exponential trendline to my various scatterplots. I have 8 tree species with different relationships of their height (in meters) and its diameter at breast height (DBH for short in cm). For now I have managed to do the different scatter plots for each tree species, but I can't seem to find a way to add an exponential trendline. <a href="https://i.stack.imgur.com/ckgqT.png" rel="nofollow noreferrer">Scatter Plot of DBH - Height Relationship per Tree type</a></p>
  <p>The code I used is as follows:</p>
  <pre><code>ggplot(data, aes(Height__m_,DBH__cm_)) +
    geom_point(aes(color = Species)) +
    facet_wrap(~Species, ncol = 4, nrow = 2) +
    labs(title = &quot;DBH - Height Relationship&quot;, y = &quot;Height (m)&quot;, x = &quot;DBH (cm)&quot;)
  </code></pre>
  <p>When I add the <code>geom_smooth</code> function, I can't seem to add an exponential trendline since I know these types of relationships to be the best fit. The code I've tried using is:</p>
  <pre><code> geom_smooth(method = &quot;nls&quot;, formula =  y ~ a * exp(b * x), aes(color = &quot;Exponential&quot;),
            se = FALSE, start = c(a = 1, b= 1))`
  </code></pre>
  <p>If there's also a possibility of adding the R2 value, that would also be welcomed.
  I would appreciate the help!</p>