I am having an issue with creating a bar graph of proportions.
This is my current code:
ggplot(data = d,
aes(fill = version)) +
theme(legend.position = 'bottom') +
geom_bar(aes(x = cregion,
y = ..count../sum(..count..)),
position = 'dodge') +
scale_y_continuous(labels = percent) +
coord_flip()
Which produces this:
This scales the bars so that the total sum is 100%, however. What I want is for the salmon bars to sum to 100%, and also for the aqua bars to sum to 100%. In other words, I am interested in the proportions within the scaling. Is there a way to do this with ggplot besides just going into my data and mucking around with my variables?