Re: [R] order stacked bar plot from total frequency

2021-09-16 Thread Jim Lemon
Hi Kai, I don't know about ggplot, but it may be easier to do it before plotting: set.seed(753) testdat<-matrix(sample(1:10,9),nrow=3) # first plot the raw matrix barplot(testdat) # then plot the matrix ordered by column sums barplot(testdat[,order(colSums(testdat))]) Jim On Fri, Sep 17, 2021 at

[R] order stacked bar plot from total frequency

2021-09-16 Thread Kai Yang via R-help
Hello List, I can order the general bar chart based on frequency, using ggplot2 with the code : aes((reorder(Var1, Freq)), Freq))  I don't know how to order stacked bar plot by total frequency Can you give me some of example? Thank you Kai [[alternative HTML version deleted]] ___