R: Stacked bar plot
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.
• 1,543 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello KVC_bioinfo!
We believe that this post does not fit the main topic of this site.
Pure R question, please search StackOverflow
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!