title: How to draw confidence bounds to better demonstrate the confidence interval on ggplot2?
body: <p>This code draws the regression line, the confidence interval and the prediction interval. The confidence interval is colored in gray. I need to add a code to draw the confidence bounds to better demonstrate the confidence interval.</p>
  
  <pre><code>library(ggplot2)
  x&lt;-Allele&lt;- c(4,4,5,5,5,7,9,11,11,11,13,14,15,15,16,17,17,19,19,19)
  y&lt;-SR&lt;- c(5.5,5.6,5.7,6,6.1,8,8,12,12.1,13,14,14,16,16.5,17,17,
  17.1,18,19,20)
  D3S = data.frame(Allele, SR)
  Mod &lt;- lm(SR ~ Allele) 
  pred.int &lt;- predict(Mod, interval = "prediction")
  mydata &lt;- cbind(D3S, pred.int)
  # Regression line + confidence interval
  p &lt;- ggplot(mydata, aes(Allele, SR)) +
  geom_point(size=3) +
  stat_smooth(method = lm, color="black")
  # Add prediction intervals
  myplot= p + geom_line(aes(y = lwr), color = "black", 
  linetype = "dashed", size=0.8)+
  geom_line(aes(y = upr), color = "black", 
  linetype = "dashed", size=0.8)
  myplot + theme_bw() + theme(panel.border = element_blank(), 
  panel.grid.major = element_blank(),
  panel.grid.minor = element_blank(), 
  axis.line = element_line(colour = "black"))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/h7LSQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h7LSQ.png" alt="Like this"></a></p>