Is it possible to rename a legend that combines various aesthetics in ggplot2
For instance:
How can I rename such a combined legend? . When I try to use namefor scale_shape_manualor scale_color_manual, the combined legend is divided into two different legends. This is not what I want.
Possible solution: The solution I found here is: https://stackoverflow.com/a/318618/2328/ worked for me ...
In principle, there are two possible approaches, in both of them for a combined legend, in order to get a new name, nametwo different legends that are combined must be changed as one and the same:
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")
or
guides(shape=guide_legend(title="Combined Legend Title"), color=guide_legend(title="Combined Legend Title"))
Still wondering if there is an easier way to do this?
cross source
share