title: How to make an overlapping barplot?
body: <p>Making a barplot the 'standard' way</p>
  
  <pre><code>dat &lt;- read.table(text = "A   B 
  + 1 1 4
  + 2 2 3
  + 3 3 2
  + 4 4 1", header = TRUE)
  barplot(as.matrix(dat))
  </code></pre>
  
  <p>gives a barplot like this:</p>
  
  <p><img src="https://i.stack.imgur.com/Vn0nc.png" alt="enter image description here"></p>
  
  <p>Instead, I would like to have the different segnments to overlap, like so</p>
  
  <p><img src="https://i.stack.imgur.com/H8g23.png" alt="enter image description here"></p>
  
  <p>How can I make such a plot in R?</p>