title: Limiting the x-axis range of geom_line (defined by slope and intercept)
body: <pre><code>library(ggplot2)
  ##
  df &lt;- as.data.frame(matrix(rnorm(60*2, mean=3,sd=1), 60, 2))
      colnames(df) &lt;- c("A", "B")
      cf1 &lt;- coef(lm(B~A, data=df))
  ##    
  ggplot(df, aes(A,B)) +
    geom_point() +
    stat_smooth(method = "lm", color="red", fill="red", alpha=0.1, fullrange=TRUE) +
    #xlim(0,6)+
    geom_abline(intercept = cf1[1], slope = cf1[2], lty="dashed", col="green") 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4mCNR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4mCNR.jpg" alt="Example"></a></p>
  
  <p>I want to limit geom_line to the same range as stat_smooth (which seems to be defined by xmax/xmin).
  The xlim argument did not help (this was proposed <a href="https://stackoverflow.com/questions/17489243/fullrange-true-ignored-in-stat-smooth">here</a>). In the real life application, the geom_line slope and intercept will be extracted from model updates, so they will be slightly different. Thank you.</p>