change both legend titles in a ggplot with two legends change both legend titles in a ggplot with two legends r r

change both legend titles in a ggplot with two legends


Here is an example using the iris dataset:

data(iris)ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width)) +    geom_point(aes(shape=Species, colour=Petal.Width)) +     scale_colour_gradient() +    labs(shape="Species label", colour="Petal width label")

You specify the labels using labs(), with each scale separately specified, i.e. labs(shape="Species label", colour="Petal width label").

enter image description here


If I understood your point correctly, you can simply use + labs(shape = "shape legend title", colour = "colour legend title")