Other package: the package factoextra

The package Factoextra has been developed for people who like using ggplot2.

The Factoextra package is an alternative to the graphical functions offered by FactoMineR and Factoshiny.

This package has been developed for people who like using ggplot2.

It can be used to construct graphs sequentially, gradually adding layers of graphical elements.

The following code is used to obtain the default representation of individuals:

res.pca = PCA(decathlon[,1:10], quanti.sup=11:12,quali.sup=13)

To change the title of the graph or the legends associated with the dimensions, simply add a layer using the labs and write:

fviz_pca_ind(res.pca) + labs(title="PCA", x="PC1", y="PC2")

Below are three ways of obtaining a representation of individuals according to their contribution:

fviz_pca_ind(res.pca, col.ind="contrib")
fviz_pca_ind(res.pca, col.ind="contrib") + scale_color_gradient2(low="blue", mid="white",high="red", midpoint=4)
fviz_pca_ind(res.pca, col.ind="contrib") + scale_color_gradient2(low="blue", mid="white", high="red", midpoint=4) + theme_minimal()