我在应用两种不同的变化到我的ggplot2
对象时遇到了问题。我有一个带有3个组的条形图。我想要:
- 为每个组设置颜色
- 重新排序图例标签的顺序
我已经找到了以下解决方案:
+ scale_fill_manual(values = c("red", "green", "blue"))
+ scale_fill_discrete(guide = guide_legend(reverse=TRUE))
问题是第二个应用(+ scale_fill_discrete(...)
)会覆盖第一个。
Scale for 'fill' is already present. Adding another scale for 'fill', which will replace the existing scale.
(分别它们都能正常工作)。怎么处理呢?