title: Plot horizontal lines for pairwise points in R
body: <p>I'm learning to plot in R and looking for ways to add horizontal lines for pairwise point data if they satisfy basic inequality condition. For example, I have 3 sets of output values for a given set of input.  </p>
  
  <pre><code>input &lt;- c(1,2,3,4)
  a &lt;- c(1,2,3,4)
  b &lt;- c(2,3,4,5)
  c &lt;- c(5,6,7,3)
  plot(a, input, xlim=c(min(a,b,c), max(a,b,c)), pch=16, col=rgb(0,0,0,0.5), xlab='output', ylab='input')
  points(b, input, pch=16, col=rgb(1,0,0,0.5))
  points(c, input, pch=16, col=rgb(0,1,0,0.5))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/z1ESn.png" rel="nofollow"><img src="https://i.stack.imgur.com/z1ESn.png" alt="enter image description here"></a></p>
  
  <p>However, I want to illustrate the pairwise differences in the output values. So, instead of a scatter plot, I want a line (yellow) connecting the black (a) and red (b) dots for each input <code>i</code> if <code>b[i] &gt; a[i]</code>. Similarly, I'd have another line (blue) connecting the red (b) and green (c) dots if <code>c[i] &gt; b[i]</code>.</p>
  
  <p>How would I do that? </p>