-1

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

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

summary(FrogPCA)

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

任何帮助表示赞赏!

4

2 回答 2

1

这是一个示例,如何根据数据集(不幸的是您不提供数据)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))

在此处输入图像描述

于 2019-02-20T02:57:28.420 回答
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)))

在此处输入图像描述

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

希望能帮助到你。

于 2019-02-20T02:29:23.727 回答