title: Graph function from multiple coefficient estimates with ggplot in R
body: <p>I am trying to graph the implied functions from my regression estimates on the same figure in ggplot. In the example below i create a simple linear function where c and b are coefficient estimates stored from a earlier regression. I am trying to then plot the functions over the range [0,50] by groups (preferably also using the option: colour = groups).</p>
  
  <pre><code>library(ggplot2)
  
  groups = c("a", "b", "c")
  c = c(5, 4, 3)
  b = c(-0.01, -0.002, -0.001)
  x = c(0, 0, 0)
  df &lt;- data.frame(cbind(c, b, x))
  
  grad_fun &lt;- function(x) {
    c + b*x
  }
  
  ggplot(data = df, aes(x = x, group = groups)) +
    stat_function(fun = grad_fun) + 
    xlim(0, 50)
  </code></pre>
  
  <p>My figure comes out like this, but i cannot seem to find out why. Any suggestions on how to solve this problem are welcome.
  <a href="https://i.stack.imgur.com/uxp4V.png" rel="nofollow noreferrer">Image: Outcome of above code</a></p>