How can I prevent geom_point points from overlapping labels in R?

923 Views Asked by At

I am making a PCA plot using autoplot, and I wanted to enlarge the point size. I used geom_point() for this purpose, however, this makes the larger points layer on top of (and cover) the text of my variables. How can I solve this?

This is my code:

chem20.pca <- prcomp(chem20[,c(3:23)], center = TRUE, scale. = TRUE)
autoplot(chem20.pca, data=chem20, colour="Location", loadings = TRUE, loadings.colour = 'black', loadings.label.colour='black', loadings.label = TRUE, loadings.label.size = 4, loadings.label.repel=TRUE) + geom_point(aes(color = chem20$Location, size = 1)) + guides(size = "none")

And the output graph from it:

PCA plot with points overlapping labels

As you can see, some of the variable names are being covered by the points.

Can anyone help me modify this plot so that the points are not covering the labels?

0

There are 0 best solutions below