Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201894

Pyramidal (not rightangular) stacked barplot in R

$
0
0

Using the following code, I can create a simple stacked barplot that has a rightangular shape:

barplot(as.matrix(prop.table(c(150,90,60))),col=c('Cornflowerblue','Yellow','Red'),las=1)

The output looks like this

enter image description here

However, I want to build a barplot that is a pyramid, such that the breakdown of percentages is by its area not by its length. Since the tip of the pyramid has much smaller area than the bottom, the corresponding pyramid plot should look something like this

enter image description here

I'm just not sure how to code such a plot in R. Any suggestion would be appreciated.


Viewing all articles
Browse latest Browse all 201894

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>