001、直接绘图效果:
library(ggplot2) bp <- ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot() ## 绘图 bp ## 显示绘图结果
绘图结果如下:
002、修改图例显示的顺序
bp + scale_fill_discrete(breaks=c("trt2","ctrl","trt1")) ## 修改图例显示的顺序
标签:顺序,修改,图例,绘图,bp,ggplot2 From: https://www.cnblogs.com/liujiaxin2018/p/17248218.html