【问题标题】:R-Hiding/Deleting Vectors in my biplot with PCA使用 PCA 在我的 biplot 中隐藏/删除向量
【发布时间】:2019-07-13 15:16:19
【问题描述】:

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

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

summary(FrogPCA)

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

感谢任何帮助!

【问题讨论】:

  • 你好。您的意思是要查看新转换坐标中的点?
  • 是的!所以只需删除新图中的向量!

标签: r pca biplot


【解决方案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 维上执行相同的操作。如果它有用,我可以稍后编辑。

希望对你有帮助。

【讨论】:

    【解决方案2】:

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

    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))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 2021-12-27
      • 1970-01-01
      • 2018-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多