I am running PCA of my data (that consists of 8 groups. The ordering is important for the consistency between figures. However, it seems that fviz_pca_ind() function automatically sorts my groups by alphabetical order, instead of keeping the order from the original data frame.
pca.res <- PCA(df, graph = FALSE)
fviz_pca_ind(pca.res, geom = "point", habillage = sample_info$Diet, addEllipses = TRUE, palette = c("#000000", "#757575", "#70b4d8", "#054784", "#fce119", "#efbb00", "#ef8f00", "#bfbfbf"), title = "Plasma amino acid concentrations")
Basically, I simply need it to keep the group order exactly as it appears in the sample_info$Diet variable that is used for habillage.
Currently, the groups are ordered: high-prot, LeuIle, LNAA,..., WT, Thr. What I need is: WT, LNAA, LeuIle, ..., high-prot.