Home > Enterprise >  Adding labels to ellipses in a PCA in r
Adding labels to ellipses in a PCA in r

Time:09-16

¿Is there some way to add labels to ellipses in a PCA?

E.g. I would like to add labels to these ellipses enter image description here

like that:

enter image description here (See the bold and big words over each ellipse, for this example I added labels with Photoshop)

Code:

data(iris)
res.pca <- prcomp(iris[, -5],  scale = TRUE)

fviz_pca_biplot(res.pca, label = "var", habillage=iris$Species,
                addEllipses=TRUE, ellipse.level=0.95,
                ggtheme = theme_minimal())

In the "label" argument there is not an option to put labels on the ellipses, and I do not have any idea how to add labels over each ellipse.

I will be very grateful with some direction

The script come from enter image description here

  • Related