Take the 2-minute tour ×

I was looking here but I can't figure it out.


share|improve this question
add comment

1 Answer

up vote 23 down vote accepted


+ labs(colour = "legend title") 




share|improve this answer
Thank you Roman!! Could you also tell me how I could change the text for "A" and "B"? –  Brani May 6 '11 at 12:57
@brani - The answer depends on where "A" and "B" are in your plot. Are they values that get plotted? An axis label? Assuming they are values that are plotted on the x-axis, you could do something like this scale_x_discrete(breaks = c("a", "q", "z"), labels = c("foo", "bar", "baz")) to change the labels for the values a, q, and z. You could also address the issue outside of ggplot before you plot. If "A" and "B" are an axis label, xlab("pink monkeys") or ylab("aardvarks are angry") should do the trick. –  Chase May 6 '11 at 13:20
@Roman: If you have something like: ggplot(aes(..., colour=g, lty=g, groups=g)) then your answer doesn't work. Instead, it creates an additional legend. –  csgillespie May 6 '11 at 20:59
I thought that either "color" or "colour" could be used, but it seems that in this case that "colour" has to be used as the keyword –  Mark Nov 9 '11 at 23:46
@Mark, yeah, very counter-intuitive and user-unfriendly... =/ –  aL3xa Mar 12 '12 at 0:42
show 8 more comments

Your Answer


