I want to change the colours of my clusters but maintain the shape. habillage=iris$Species
changes both colour and shape, what can to change only colours?
library("devtools")
install_github("kassambara/factoextra")
library("factoextra")
res.pca <- prcomp(iris[, -5], scale = TRUE)
fviz_pca_ind(iris.pca, geom="point", pointsize = 1, habillage=iris$Species, addEllipses=TRUE, ellipse.level=0.95)
fviz_pca()
works like ggplot plots, hence, for changing shapes you can use the aesthetic mappings of ggplot, e.g., for changing shapes. Concerning colors, the documentation called by ?fviz_pca_ind
tells you that you can change colors via palette
.
fviz_pca_ind(res.pca, geom="point", pointsize = 1, habillage=iris$Species, addEllipses=TRUE, ellipse.level=0.95
, palette = c("green", "orange", "grey") #change colors
) +
scale_shape_manual(values=c(2, 8, 11)) #change shapes