ggplot2绘图中移除图例

发布时间 2023-03-23 17:09:06作者: 小鲨鱼2018

 

001、

a、利用测试数据绘制箱线图

library(ggplot2)
bp <- ggplot(data=PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot() ## 绘图
bp      ## 显示绘图结果

绘图结果如下:

 

 

b、移除图例

bp + guides(fill=FALSE)

移除结果:

 

 

参考:https://www.jb51.net/article/256254.htm