Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colour individuals by custom continuous variable #29

Closed
enricoferrero opened this issue Mar 6, 2017 · 1 comment
Closed

Colour individuals by custom continuous variable #29

enricoferrero opened this issue Mar 6, 2017 · 1 comment

Comments

@enricoferrero
Copy link

Hello,

in 'fviz_pca_ind()', 'fviz_mfa_ind()' and similar functions, is it possible to colour individuals using a custom continuous variable?

I'm aware you can do that using one of the presets (e.g.: 'cos2') passed to the 'col.ind' argument and that you can use the 'habillage' argument to colour individuals using a custom factor variable, but neither of those things seems to be doing what I need.

Thank you!

Edit: Alternatively, is there a way to extract the ggplot2 object and edit it?

kassambara added a commit that referenced this issue Mar 13, 2017
kassambara added a commit that referenced this issue Mar 13, 2017
@kassambara
Copy link
Owner

Should work now:

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

rplot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants