title: How to add legend to geom_smooth in ggplot in R
body: <p>Have a problem of adding legend to different smooth in ggplot.</p>
  
  <pre><code>    library(splines)
      library(ggplot2)
      temp &lt;- data.frame(x = rnorm(200, 20, 15), y = rnorm(200, 30, 8))
  
      ggplot(data = temp, aes(x, y)) + geom_point() + 
        geom_smooth(method = 'lm', formula = y ~ bs(x, df=5, intercept = T), col='blue') + 
        geom_smooth(method = 'lm', formula = y ~ ns(x, df=2, intercept = T), col='red')
  </code></pre>
  
  <p>I have two splines: red and blue. How I can add a legend for them?</p>