[R] ggplot rank stack bar automatically.

Ista Zahn istazahn at gmail.com
Sat Feb 18 16:29:23 CET 2012


Hi,

Here is what I get before reordering:
http://izahn.homedns.org/tmp/barplotOriginal.png

and after reordering:
http://izahn.homedns.org/tmp/barplotReordered.png


Are you saying you get something different? Or that this is not what you were 
trying to do?

Best,
Ista
On Friday, February 17, 2012 08:41:05 PM vd3000 wrote:
> Hi, Ista,
> 
> 1.
> /"df.m <- transform(df.m, Period = reorder(Period, -1*value))
> 
> ggplot(df.m, aes(x = Period, y = value/1e+06, fill = Region))  +
>   geom_bar(stat = "identity", position = "stack") "/
> 
> I have followed your instruction but I found the sequence did not change.
> 
> 2. I am looking for the stack value, I have read many threads and eventually
> I think I should make a new frame and reorder it, after order it and put it
> as a new level for df.m and let it identify the sequence...
> 
> I am still exploring how to intergrate it to the melt data df.m
> 
> Thanks...
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/ggplot-rank-stack-bar-automatically-tp4391042
> p4399172.html Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list