ggplot图例

用ggplot作图移除图例
library(ggplot2)
p <- ggplot(PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot()
p + guides(fill=FALSE)

改变图例位置
p <- ggplot(PlantGrowth, aes(x=group, y=weight, fill=group)) + geom_boxplot() +
scale_fill_brewer(palette=“Pastel2”)
#上方
p + theme(legend.position=“top”)#左边left,右边 right, 底部bottom

作者:zx403413599
来源:CSDN
原文:https://blog.csdn.net/zx403413599/article/details/48581713
版权声明:本文为博主原创文章,转载请附上博文链接!
1.修改图例名称
labs(fill=“name”)
2.隐藏图例标题
theme(legend.title=element_blank()
3.修改图例顺序
scale_color_discrete(limits=c(“a”,“d”,“c”))
4.不加legend
+theme(legend.position = “none”)
5.删除legend.title
theme(legend.title = element_blank())
6.修改legend的位置
theme(legend.position = “left”)#(right,top,bottom)
7.修改尺寸大小
theme(legend.text = element_text(colour = “red”,angle=45,size=10,hjust=3,vjust=3,face=“bold”))
8.颜色的修改及一致性
geom_bar(position = “stack”,aes(order=desc(name)))

作者:chiristina1993
来源:CSDN
原文:https://blog.csdn.net/qq_42458954/article/details/81154932
版权声明:本文为博主原创文章,转载请附上博文链接!

  Markdown
   0 字数
2 行数
 当前行 2, 当前列 0
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值