Michael, Do not cross-post! I've answered this question on the ggplot2 list.
On Mon, Oct 14, 2013 at 11:27 AM, Arnaud Michel <michel.arn...@cirad.fr> wrote: > Hello > I had draw the results of PCA (Principal Components Analysis) (1) > Is it possible to put on this graphic the 75% ellipse confidence of each sex > calculated by dataEllipse (library(car)) ? > > My code is > 1) PCA data frame with 169 rows and 2 columns > library(ggplot2) > p <- ggplot(PCA, aes(x=F1, y=F2 )) > p + geom_point(aes(colour = Sexe, shape = Sexe), size=3) + > geom_hline(yintercept = 0) + > geom_vline(xintercept = 0) + > labs(title = "ACP", > x = "Facteur 1", y = "Facteur 2",fill = "Sexe") + > theme(legend.position = c(0.95,0.95), > legend.background = element_rect(colour = "black")) > > 2) library(car) > XH <- dataEllipse( > X1[ACP$Sexe=="H"], > X2[ACP$Sexe=="H"], > levels=0.75, lty=2, add=TRUE, plot.points=FALSE, center.cex=0, col=4) > > XF <- dataEllipse( > X1[ACP$Sexe=="F"], > X2[ACP$Sexe=="F"], > levels=0.75, lty=2, add=TRUE, plot.points=FALSE, center.cex=0, col=2) > > XH and XF are two matrix with 2 columns and 52 rows > Thank you for your help > > -- > 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.