ggplot2 stacked pyramid by category

Hi,
My data looks like:

school gender n
1 1 200
1 2 230
2 1 60
2 2 215
...

I want to build a stacked pyramid with school at Y axis and n in X axis.
Each step of pyramid should show which part of students is female and which male
Please help

Do you mean like a population pyramid?

If so, this link is a very helpful tutorial on how to make one.
https://rpubs.com/walkerke/pyramids_ggplot2

3 Likes

Thank you Mara this is very useful.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.