Entering edit mode
5.2 years ago
KVC_bioinfo
▴
590
Hello all,
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)
ggplot(data, aes(fill=condition, y=value, x=specie)) +
geom_bar( stat="identity")
I have this code which works fine for creating a stacked bar plot in R. However, I want to create a stacked plot where it should give cumulative values. For example: for species, sorgho first, fill should be Nitrogen then stress and then normal (Were the values are getting added in order while plotting)
Can anyone help me here?
Thanks in advance.