title: population pyramid density plot in r
body: <p>I would like to create pyramid density plot like the following:</p>
  
  <p><img src="https://i.stack.imgur.com/xjL44.jpg" alt="enter image description here"></p>
  
  <p>The point that I can reach is just simiple pyramid plot based on the following sample example:</p>
  
  <pre><code>set.seed (123)
  xvar &lt;- round (rnorm (100, 54, 10), 0)
  xyvar &lt;- round (rnorm (100, 54, 10), 0)
  myd &lt;- data.frame (xvar, xyvar)
  valut &lt;- as.numeric (cut(c(myd$xvar,myd$xyvar), 12))
  myd$xwt &lt;- valut[1:100]
  myd$xywt &lt;- valut[101:200]
  xy.pop &lt;- data.frame (table (myd$xywt))
  xx.pop &lt;- data.frame (table (myd$xwt))
  
  
   library(plotrix)
   par(mar=pyramid.plot(xy.pop$Freq,xx.pop$Freq,
      main="Population Pyramid",lxcol="blue",rxcol= "pink",
    gap=0,show.values=F))
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/vHbDI.jpg" alt="enter image description here"></p>
  
  <p>How can I achieve this ?</p>