Off topic:R: Stacked bar plot
0
0
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.

R stackedplot • 1.4k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 3237 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6