[英]PCA analysis remove centroid
I am using fviz_pca_ind
to make PCA plot see below.我正在使用
fviz_pca_ind
来制作 PCA plot 见下文。
fviz_pca_ind(res.pca, geom="point", pointsize = 1, habillage=iris$Species, addEllipses=TRUE, ellipse.level=0.95
, palette = c("green", "orange", "grey"))
I want to remove the centroid but maintain the different colors and ellipses that I get with habillage=iris$Species
.我想删除质心但保留不同的 colors 和我用
habillage=iris$Species
得到的椭圆。
col.ind
requires a vector with a number of elements equal to the lines number. col.ind
需要一个向量,其元素数等于行数。
Here is a way to remove centroids: 这是删除质心的一种方法:
library(factoextra)
data(iris)
res.pca <- prcomp(iris[, -5], scale = TRUE)
fviz(res.pca, element="ind", geom="point", pointsize = 1,
habillage=iris$Species, addEllipses=TRUE, ellipse.level=0.95,
palette = c("green", "orange", "grey"), invisible="quali")
There is in fact a much simpler way directly in the fviz_pca_ind (and fviz_pca_biplot) function: "To remove the group mean point, specify the argument mean.point = FALSE."事实上,直接在 fviz_pca_ind(和 fviz_pca_biplot)function 中有一个更简单的方法:“要删除组均值点,请指定参数 mean.point = FALSE。” ( source ).
( 来源)。 So:
所以:
library(factoextra)
data(iris)
res.pca <- prcomp(iris[, -5], scale = TRUE)
fviz_pca_ind(res.pca, geom="point", pointsize = 1, habillage=iris$Species, addEllipses=TRUE,
ellipse.level=0.95, palette = c("green", "orange", "grey"), mean.point=F)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.