How can I adjust the dimension of the axes fviz_pca

3k views Asked by At

I'm trying to put the two axes of my biplot exactly equally scaled (i.e., 1 cm on the vertical axis must represent the same 1 cm on the horizontal axis). How can I do that with fviz_pca? or there is some better pca package?

My code

fviz_pca_ind(res.pca,
         col.ind = groups, # color by groups
         palette = c("#00AFBB",  "#FC4E07"),
         addEllipses = TRUE, # Concentration ellipses
         ellipse.type = "convex",
         legend.title = "Groups",
         repel = T, ggtheme=theme(axis.text=element_text(size=16), axis.title=element_text(size=16)))

PCA fviz_pca_ind

1

There are 1 answers

1
Legimens On

As the fviz function works based on ggplot2 you just need to add the information of axis lenght at the end of the funtion like this:

fviz_pca_biplot(scaptotrigona.pca,[...]) +xlim(-1, 1) + ylim (-1, 1)

remember that the values inside the "xlim()" and "ylim()" mus be equals, if you use "xlim(-1, 5)" for example, it won't work.