r - 如何在 pca biplot 中显示观察结果?
问题描述
我希望使用 factoextra 包在主成分分析双图上显示观察行名称。
library(factoextra)
## organize dataset to obtain unique rownames
iris$id <- rownames(iris)
iris$id <- paste(iris$Species, iris$id, sep="_")
rownames(iris) <- iris$id
iris <- iris[,1:4]
## Run PCA
pca <- prcomp(iris, center=T, scale. = T)
## On this plot observation names are displayed
fviz_pca_ind(pca,
col.ind = "cos2", # Color by the quality of representation
gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
repel = TRUE
)
## Is there any way to display the same row names in this plot? (instead of points)
fviz_pca_biplot(pca,
col.var = "#2E9FDF", # Variables color
col.ind = "#696969", # Individuals color
label = 'var',
repel = TRUE
)
提前致谢
解决方案
推荐阅读
- ats - 声明相互递归的类型
- android - 使用模拟依赖项进行 Android UI 测试
- android - 通过 uiSelector 中的间接父级查找 uiObject
- shell - 在 UNIX 中使用 sed 的正则表达式
- javascript - 构建自定义音量滑块
- drone - Drone 服务器之间的 Drone 自托管、管道路由
- python - 将原始 Ipython Notebook txt 转换为 Ipynb
- oracle - 刷新嵌套物化视图时如何捕获错误
- memory - cudaMemcpy 传输类型:默认 vs HostToDevice/DeviceToHost
- matlab - 相位延迟补偿 IIR 滤波器 Matlab 2012