我们知道,在ggplot2里面,如果要对一个简单的柱状图(只包含X和Y)进行排序,只需要在aes()中将原本的x进行排序:reorder(x,y)即可;但是如果一个图中有几个组的柱状图同时存在呢? 我们先来举个例子: library(dplyr) library(ggplot2) df<-read.table(text = ' Care variable value D Equipment 0 D Equipment 1...
作图代码 ggplot()+ geom_bar(data=df01, aes(x=1,y=value,fill=group01), stat="identity",position = "fill")+scale_fill_manual(values = c("#827f88","#3288bd","#f36c44", "#e4e569","#b9b9dd","#000000"), breaks = rev(c("Others","Proteobacteria", "Firmicutes","Bacteroidota",...