Hi I usually use scale....
something like scale_fill_discrete(name = "Fancy Title") shall do the trick Regards Petr > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Arnaud Michel > Sent: Friday, October 11, 2013 11:02 AM > To: R help > Subject: [R] ggplot2 : to change the title of legend > > Hello > I don't arrive to change the title of the legend My code is : > library(ggplot2) > ma <- max(General$AgeChangCat) ; mi <- min(General$AgeChangCat) > Test$Recrutement <- factor(Test$CadNonCadRecrut) p <- ggplot(Test, > aes(x=factor(Cat1), y=AgeChangCat )) + > ylim(mi,ma) + > geom_point() + > geom_boxplot(aes(fill = Recrutement)) + > labs(title = "Age", x="catégorie", y="Age") + theme(legend.position = > c(0.1,0.9), legend.background = element_rect(colour = "black")) p > > any idea ? > > -- > Michel ARNAUD > Chargé de mission auprès du DRH > DGDRD-Drh - TA 174/04 > Av Agropolis 34398 Montpellier cedex 5 > tel : 04.67.61.75.38 > fax : 04.67.61.57.87 > port: 06.47.43.55.31 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.