[R] ggplot2 : to change the title of legend

Arnaud Michel michel.arnaud at cirad.fr
Fri Oct 11 11:01:37 CEST 2013


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



More information about the R-help mailing list