用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