使用PCA在我的双色标中R-隐藏/删除矢量

问题描述 投票:-1回答:2

所以我只是希望能够清楚地看到这些点,并摆脱向量,因为我没有解释这些,这是我的代码:

FrogPCA <- prcomp(FrogData[,3:12], center=TRUE, scale=TRUE)

summary(FrogPCA)

biplot(FrogPCA, choices = c(1,2), col = c("magenta3", "slateblue3" ))

任何帮助表示赞赏!

r pca biplot
2个回答
1
投票

怎么样(这个例子是虹膜):

> data(iris)
> #iris
> 
> IrisPCA <- prcomp(iris[, 1:3], center = TRUE, scale = TRUE)
> table(iris$Species)

    setosa versicolor  virginica 
        50         50         50 
> 
> plot(IrisPCA$x, col = c(rep("red", 50), rep("green", 50), rep("blue", 50)))

enter image description here

有一个叫做plot3D的包可以在3个维度上执行相同的操作。如果它有用,我可以稍后编辑。

希望能帮助到你。


0
投票

下面是一个如何基于biplot数据集重新生成没有未缩放轴(即红色箭头)的USAarrests输出的示例(遗憾的是,您不提供数据)。

pca <- prcomp(USArrests, scale = TRUE)

plot(pca$x[, "PC1"], pca$x[, "PC2"], type = "n", xlab = "PC1", ylab = "PC2")
text(pca$x[, "PC1"], pca$x[, "PC2"], rownames(pca$x))

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.