title: Stacked Histograms Using R Base Graphics
body: <p>Using <code>ggplot2</code> it is very easy to create stacked histograms: </p>
  
  <pre><code>library(ggplot2)
  
  ggplot(data = iris, aes(x = Sepal.Length, fill = Species)) + 
    geom_histogram(colour = 'white') 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4pxiB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4pxiB.png" alt="enter image description here"></a></p>
  
  <pre><code>ggplot(data = iris, aes(x = Sepal.Length, fill = Species)) + 
    geom_histogram(colour = 'white', position = 'fill')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DHmua.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DHmua.png" alt="enter image description here"></a></p>
  
  <p>I would like to know how to create both histograms using only <strong>R base graphics</strong>.</p>