ggplot2: 图例操作

2023-07-02  本文已影响0人  LET149

https://www.cnblogs.com/yangk/p/4761994.html
https://blog.csdn.net/zx403413599/article/details/48581713

1. 调整图例的位置

plot()+theme(legend.position="right")
plot()+theme(legend.position="toprigth")

2. 对图例中各标注的位置进行排序

plot()+scale_fill_discrete(limits=表示顺序的向量)

3. 取消图例显示

plot()+theme(legend.position="none")

4. 移除图例

plot() + guides(fill=FALSE)

5. 移除图例标题

plot() + theme(legend.title=element_blank())

5. 调整图例标题位置

guides(colour = guide_legend(title.position = "left"))

上一篇 下一篇

猜你喜欢

热点阅读