title: r ggplot - change x-axis tick labels without losing geom_smooth stats
body: <p>I make a scatter plot and fit a line on it; now I need to change the tick-level labels of my x-axis, which is continuous. The data:</p>
  
  <pre><code>y &lt;- data.frame(a = 1:5, b = 5:9)
  &gt; y
    a b
  1 1 5
  2 2 6
  3 3 7
  4 4 8
  5 5 9
  </code></pre>
  
  <p>And I plot it:</p>
  
  <pre><code>   ggplot(y, aes(a, b))+
        geom_jitter()+
        stat_summary(fun.data = mean_cl_normal)+
        geom_smooth(method = 'lm', formula = y~x)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/NgMff.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NgMff.png" alt="enter image description here"></a></p>
  
  <p>This is not bad, but I need to change the labels at the x-axis tick level, to make them meaningful, so I try with this:</p>
  
  <pre><code>ggplot(y, aes(a, b))+
    geom_jitter()+
    stat_summary(fun.data = mean_cl_normal)+
    geom_smooth(method = 'lm', formula = y~x)+
    scale_x_discrete("A_Variable", c("a","b","c","d","f"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3IOWW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3IOWW.png" alt="enter image description here"></a></p>
  
  <p>It doesn't work. I learn from another SO question that I need to change the x variable to factor, but when I do this, I lose my <code>geom_smooth</code> line. How do I change the tick-level labels of my x-axis without losing my <code>geom_smooth</code> stats?</p>