我正在努力更改双标图的加载标签。我使用 prcomp 函数来运行 PCA 和 ggbiplot。我试图用 改变它loading.label.label = c("a","b","c","d")
,但它没有用。我在下面附上了我的代码和情节。
k <- kmeans(comp,2)
TW$Group <- factor(k$cluster)
pca2 <- prcomp(TW[,c(7,11,18,19)], center = TRUE, scale. = TRUE)
summary(pca2)
pca2
cc <- c("a","b","c","d")
library(ggbiplot)
p <- ggbiplot(pca2, group = TW$Group, ellipse = TRUE,loadings.label.repel = TRUE) +
ggrepel::geom_text_repel(aes(colour = TW$Group, label = paste(TW$P,TW$Box)), size = 2.5)+
theme_minimal() +
xlim(-2.5,2.5) + ylim(-2.5,3.5) + theme(legend.position = c(0.9, 0.9))
plot(p)