【发布时间】:2014-09-30 08:00:43
【问题描述】:
在我的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.
(分别它们都可以正常工作)。如何处理?
【问题讨论】:
标签: r colors plot ggplot2 scale