title: fitting geom_smooth() to multiple categories in ggplot2
body: <p>I have some data which looks like:</p>
  
  <pre><code>sample  diff    chromosome  haploid coverage
  B   90.9963099631   7   b   0.513
  A   91.7019475021   12  a   8.234
  C   90.3855783676   14  a   6.211
  D   91.3407821229   17  b   4.321
  E   91.5740740741   11  b   0.213
  F   90.9963099631   7   b   0.513
  G   91.7019475021   12  a   8.234
  H   90.3855783676   14  a   6.211
  I   91.3407821229   17  b   4.321
  J   91.5740740741   11  b   0.213
  </code></pre>
  
  <p>And I want to visualise the change for 'diff' for different coverage value, across different chromosomes, so I did this:</p>
  
  <pre><code>plot = ggplot(dat, aes(x = coverage, y = diff, group  = chromosome, colour = chromosome, ylim(0, 100)) ) + geom_point(colour = chromosome) + stat_smooth(se=FALSE) + ylim(0, 100)
  
  `geom_smooth()` using method = 'loess'
  </code></pre>
  
  <p>Now I think this isn't the best way to draw mutliple trendlines, but I produced this:</p>
  
  <p><a href="https://i.stack.imgur.com/esR8G.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/esR8G.jpg" alt="enter image description here"></a></p>
  
  <p>Which is kind of what I'm after. But I think in reality, all the curves shouldn't be exactly the same shape given my data, but the shape of all of them is basically identical. So has geom_smooth() plot a single LOWESS curve for all categories and then just shifted the same curve up and down for different categories? </p>
  
  <p>If so, is there a way to make it plot independent lines for each category?</p>