I\'m trying to make a stacked bar chart with text labels, this some example data / code:
library(reshape2)
ConstitutiveHet <- c(7,13)
Enhancer <- c(12
ggplot(meanCombM,aes(group,value,label=value)) +
geom_col(aes(fill=variable))+
geom_text(aes(group=variable),position = position_stack(vjust = 0.5))+
coord_flip()
Hadley answered a question similar to my own in this issue in ggplot2's git repository: https://github.com/tidyverse/ggplot2/issues/1972
Apparently the default grouping behaviour (see:
http://ggplot2.tidyverse.org/reference/aes_group_order.html) does not partition the data correctly here without specifying a group
aesthetic, which should map to the same value as fill
in geom_col
in this example.