I am doing a workforce mobility analysis and would like to create a pyramid chart where each level of the pyramid corresponds to job level, width corresponds to number of people at that level, and height corresponds to average number of years spent in that position.
Sample data:
employee_lvl <- c('entry','mid','supervisor', 'boss')
num_emp <- c(40, 30, 7, 1)
ave_dwell <- c(2,8, 10, 15)
df <- data.frame(employee_lvl, num_emp, ave_dwell)
Ideal Output:
I have looked at similar problems like Population pyramid in ggplot and Pyramid plot in R, but they don't vary the height and both split their populations. I have also looked at violin charts but haven't found a way to do this. Is there an easier way to create a graph like this without individually creating and stacking rectangles?
Apologies for any information or formatting errors, this is my first post.