How can I change labels' names in PCA score plot?

My file's name is "aroma."
I want to have a score plot, so I type the below text..

res.pca <- PCA(aroma[,-1], graph = FALSE)
fviz_pca_ind(res.pca, col.ind = "cos2",
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE # Avoid text overlapping (slow if many points)
The result comes out like this. The sample names are named by 1,2,3,4.....which I don't expect.

The question is how can I change these default label names to my original sample name like MC1-1, MC1-2, etc (In Column A of my excel sheet)

Thanks in advance!!

Hi @Blueberry,
Welcome to the RStudio Community Forum.

This type of PCA plot uses the row names of the dataframe to label the plots. I cannot find any other way to specify them. In your case the row names are simply numbers from 1:nrow(aroma). So, try altering your dataframe like this before analysis and plotting:

row.names(aroma) <- aroma[, 1]  # Copy first column of dataframe to row names 

p.s. In future it is best to tell us which packages you are using. There are 12 packages which have a function PCA()!