I have a bar chart with values as lables on the bars.
How can I add values from another column in the dataframe on top or along side the current lables.
The dataframe has 3 groups, counts and proportions. I want to add counts column to the lables. I hope to avoid having to merge the 2 columns into a string column.
Here is the code:
group <- c('group1','group2','group3')
count <- c(10,20,15)
prop <- c(.22,.44,.34)
data.frame(cbind(group,count,prop)) %>%
ggplot(aes(x=group, y = prop)) +
geom_col()+
geom_text(aes(label = prop),position = position_dodge(width = 0.9), vjust=1, cex =5, col = 'white')
This is different to another question posted here because I want to know how to add additional value to the bar chart not just replace what I have.