所以我只是希望能够清楚地看到这些点,并摆脱向量,因为我没有解释这些,这是我的代码:
FrogPCA <- prcomp(FrogData[,3:12], center=TRUE, scale=TRUE) summary(FrogPCA) biplot(FrogPCA, choices = c(1,2), col = c("magenta3", "slateblue3" ))
任何帮助表示赞赏!
怎么样(这个例子是虹膜):
> 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个维度上执行相同的操作。如果它有用,我可以稍后编辑。
希望能帮助到你。
下面是一个如何基于biplot数据集重新生成没有未缩放轴(即红色箭头)的USAarrests输出的示例(遗憾的是,您不提供数据)。
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))