[R] ggplot2 : to change the title of legend

Arnaud Michel michel.arnaud at cirad.fr
Fri Oct 11 15:27:41 CEST 2013


OK It is right
Thank you Petr
Michel
Le 11/10/2013 14:58, PIKAL Petr a écrit :
> Hi
>
> I usually use scale....
>
> something like
> scale_fill_discrete(name = "Fancy Title")
> shall do the trick
>
> Regards
> Petr
>
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at 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 at 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.
>

-- 
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



More information about the R-help mailing list