title: Adding a stat_function layer to a geom_point in ggplot2
body: <p>I am trying to make a trajectory line representing brain atrophy over time. I have two specific trajectories for two different groups, and I want to add each of these two lines (for comparison) to a scatterplot of Age by Brain Volume.</p>
  
  <p>The y-intercepts of these lines are 565 and 286, yet using the stat_function layer it seems to be placing the intercepts at very weird values, corrupting the overall scatterplot. Of course I can use ylim(), but then the functions don't appear (and they'd still be mis-specified even if they did).</p>
  
  <p>My code:</p>
  
  <pre><code>ggplot(na.omit(GRAPHICSMATRIX), aes(x=Age, y=FrontalPole, colour=Dx_Bl)) +
    geom_point(size=3) +  
    ylim(0, 500) + 
    stat_function(fun=function(x) {-2.129*x^3 - 23.456*x + 565}, colour="blue", size=1) +  
    stat_function(fun=function(x) (286)+((-0.997)*(x)^3), colour="darkred", size=2) 
  </code></pre>
  
  <p>Here are the graphs.</p>
  
  <p><img src="https://i.stack.imgur.com/CK3Hj.png" alt="Correct Scatterplot"></p>
  
  <p><img src="https://i.stack.imgur.com/EPaic.png" alt="Incorrect Scatterplot with two stat_function()"></p>