是否可以重命名在ggplot2
例如:
如何重命名这样的组合图例?当我尝试将name
用于scale_shape_manual
或scale_color_manual
时,组合的图例会分为两个不同的图例。那不是我想要的。
可能的解决方案:我在这里找到的解决方案:https://stackoverflow.com/a/14622513/4317408为我工作......
基本上有两种可能的方法,在两者中,组合图例获得一个新名称,两个不同图例中的name
必须被修改为相同:
scale_color_manual(values = c(brewer.pal(5, "Set1") ) , name = "Combined Legend Title") +
scale_shape_manual(values = c(1,2,3,4,5) , name = "Combined Legend Title")
或
guides(shape=guide_legend(title="Combined Legend Title"), color=guide_legend(title="Combined Legend Title"))
我仍然想知道是否有更简单的方法可以做到这一点?