Hi I can't seem to add labels to a stack plot correctly when it's normalized. For example,
specie <- c(rep("sorgho" , 3) , rep("poacee" , 3) , rep("banana" , 3) , rep("triticum" , 3) )
condition <- rep(c("normal" , "stress" , "Nitrogen") , 4)
value <- abs(rnorm(12 , 0 , 15))
data <- data.frame(specie,condition,value)
data$value = round ( data$value, 2 )
# Stacked + percent
ggplot(data, aes(fill=condition, y=value, x=specie)) +
geom_bar(position="fill", stat="identity")
The above will produce a normalized stack plot however when I add
geom_text(aes(label=value),
position=position_stack(vjust=0.5))
it does not conform to the normalization. Is there way around this? its similar to link but not quite since I don't need to calculate and I'm also adding in stat="identity"
thanks in advance.