'Color of contributions in fviz_pca_var
I have this matrix:
> res.pca
Standard deviations (1, .., p=3):
[1] 2.566251e+00 2.101037e+00 3.612421e-15
Rotation (n x k) = (11 x 3):
PC1 PC2 PC3
Gen_X_ray_h 0.23699015 0.37781446 0.01642690
Seas_Anod_curr -0.38942432 0.01701734 -0.13045632
Seas_HV_pos -0.38958573 0.01009967 -0.10566531
Seas_fil_curr 0.38830136 0.03990639 0.10615347
Oil_part_cl_1 -0.38863910 0.03465617 0.58164037
Oil_part_cl_2 -0.16974725 0.42842353 -0.68370621
Oil_part_cl_3 0.02837364 0.47469213 0.09738151
Oil_humid 0.27301050 -0.33961377 -0.08741008
Oil_temp -0.29184198 0.31538622 0.30267731
Oil_color 0.19608635 0.41130459 0.12437257
Oil_BDV -0.33288663 -0.24741521 -0.17410376
through res.pca <- prcomp(na.omit(df), scale = TRUE). But this results in this plot which lacks a color gradient or the like:
fviz_pca_var(res.pca
, col.var = "contrib"
, col.ind = "#000000"
, gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07")
, repel = TRUE
)
The command ggplotly(fviz_contrib(res.pca, choice = "var", axes = 1, top = 10)) with the same object res.pca works flawlessly:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


