Better read the Posting Guide mentioned in the footer of this and every email on this list. Attachments can only be among a very few file types and still be passed through... yours did not.
As for your question, it is very likely that the answer is yes, though since this list is about the R language rather than specifics of contributed packages ... ggplot-specific questions are technically not in scope (though if you show a good reproducible example someone might respond anyway).
But this places "Others" at the top of each bar.
To move it to the bottom, instead of the code that creates 'g' run
g <- unique(as.character(df$gene))
i <- which(g == "Others")
g <- c(g[-i], g[i])
Hope this helps,
Às 05:14 de 05/06/20, Aimin Yan escreveu:
> Is there possible to generate a barplot in the following link using ggplot?
> https://photos.app.goo.gl/E3MC461dKaTZfHza9 >
> here is what I did
> df <- read.csv(text=
> df$trt <- factor(df$trt,levels=unique(as.character(df$trt)))
> df$gene <- factor(df$gene,levels = unique(as.character(df$gene)))
> ggplot(df, aes(x=trt,y=freq, fill = gene))+geom_bar(stat = "identity",
> width = 0.5,color="black") + theme(axis.text.x = element_text(angle = 45,
> hjust = 1,size = 4))
> df$cols is the color I want to use to label different gene in M6, M12,M18
> as shown in Figure, and in each bar, the 'Others' of df$gene is always in
> the bottom of bar in M6,M12,M18
> Thank you
> [[alternative HTML version deleted]]
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.