title: How do I superimpose a regression line in a barplot in R?
body: <p>So I want to superimpose a regression line in a barplot in R. Similar to the attached image by Rosindell et al. 2011. However, when I try to do this with my data the line does not stretch the entire length of the barplot. </p>
  
  <p>For a reproducible example, I made a dummy code:</p>
  
  <pre><code>x = 20:1 
  y = 1:20
  
  barplot(x, y, space = 0)
  lines(x, y, col = 'red')
  </code></pre>
  
  <p>How do I get the lines to transverse the entire stretch of the barplot bins? </p>
  
  <p>PS: the line does not need to be non-linear. I just want to superimpose a straight line on the barplot</p>
  
  <p>Thank you. </p>
  
  <p><a href="https://i.stack.imgur.com/CurYz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CurYz.jpg" alt="Rindell et al. 2011"></a>
  <a href="https://i.stack.imgur.com/nCKUf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nCKUf.jpg" alt="My sample plot"></a></p>