ggplot2绘图中移除图例

 

001、

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

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

绘图结果如下:

 

 

b、移除图例

bp + guides(fill=FALSE)

移除结果:

 

c、移除图例:

bp + scale_fill_discrete(guide=FALSE)      ## 移除图例

 

 

d、移除图例:

bp + theme(legend.position="none")       ## 移除图例

 

 

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

 

posted @ 2023-03-23 17:05  小鲨鱼2018  阅读(645)  评论(0编辑  收藏  举报