This is a test version of Biostars. For the public version, visit https://www.biostars.org.
overlapping texts (plot.PCA in FactoMineR)

Hi, all!

I was trying to draw a PCA plot using FactoMineR (a R package). When I ran it, texts on the plots were overlapped with unknown numbers.

Here's the R code

library(FactoMineR)
pca<-PCA(dta.cor, scale.unit=T)
plot.PCA(pca,cex=1)

and the result plot

enter image description here

As you can see numbers in pink are covering sample names.

I couldn't figure it out.

Please, someone help me!!

Thank you!!!

r factominer

You can explore the options by looking at the help. ?plot.PCA It looks like it has label= and autoLab= options which may be useful to turn off the unwanted labels. Try to troubleshoot it yourself first, which is the best way to learn.

Adding to other suggestions check geom_text_repel form ggrepel Check its vignette here

Thank you, all! You guys been great help!

1 answer

You can use prcomp for PCA calculations and then plot it using ggplot and add labels using ggrepel.

ggrepel provides geoms for ggplot2 to repel overlapping text labels. It works both for geom_text and geom_label.

enter image description here

Figure is taken from this blog post.

Neat! Didn't know this ggplot feature. Thanks!

Log in to answer this question.