STHDA forum

factoextra » [Solved] How to colour individuals by custom continuous variable?

Administrator

rank_admin.png

Avatar

Signed up since: 10/02/2013

Messages: 32

On 08/16/2017 at 08h23
in 'fviz_pca_ind()', 'fviz_mfa_ind()' and similar functions from the factoextra R package, to colour individuals using a custom continuous variable, you can specify the argument col.ind as follow:

Code R :
 
library(factoextra)
data(iris)
res.pca <- prcomp(iris[, -5],  scale = TRUE)
 
# Visualize and color by a custom continuous variable
fviz_pca_ind(res.pca, col.ind = iris$Sepal.Length,
           legend.title = "Sepal.Length", 
           gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"))
 


Website    
Answer
You aren't allowed to write in this category
2 Users online : 0 Administrator, 0 Moderator, 0 Member and 2 Visitors
Users online : No member online