PCA_Graph_Of_Variables_col.var

Good morning, everyone,

I'm interested in the variability of color character in a Petunia factorial crossover design.

I have performed several PCA on individuals and I am now interested in the variables. I use the Factoextra packages, with the following codes:

res<- PCA(ACP_Petunia2020[,2:1737], scale.unit=TRUE, ncp=5, quali.sup =1736, graph=T)

fviz_pca_var(res)

My problem is the high number of variables (1735) does not allow me to interpret the circle of correlations, the graph is unreadable (see img below).

According to my research, the col.var parameter of the fviz_pca_var function allows to color the variables according to cos2 values, coordinates and axes. But it also allows to introduce a vector of values.

So I would like to color the variables according to their respective numerical values. The variables being wavelengths, it seems relevant to me to make a gradient from purple to red, for that I would use the following function:

scale_color_gradient2(low="Purple", mid="Green",high="Red", space ="Lab")

My question is how to create a vector whose components are the numerical values of each of the variables, but also how to ensure that each value is assigned to the right variable?

Thank you in advance.Graph_Variables

Hello,

Here is a reduced dataset, composed of a 10x10 data.frame:

df<-structure(list(250.643799 = c(-1.059329, 4.449154, -0.211861,
-10.381359, -9.110169, -10.593221, -15.254236, -19.915274, -22.24577,
-19.915274), 300.579315 = c(1.15572, 0.425791, -0.182479, 0.425791,
-1.76399, -1.642337, -1.034061, -3.223841, -3.832118, -5.656934
), 350.719604 = c(2.805118, 5.511807, 2.263777, 2.755901, 2.165353,
0.541336, 1.033465, -1.377953, 1.279524, -1.033465), 400.637024 = c(6.752699,
6.90276, 40.39616, 4.141655, 37.845135, 1.350539, 29.021608,
0.180073, 5.552221, 39.195679), 450.279846 = c(87.961746, 89.337967,
38.389099, 8.21382, 32.493118, 15.210775, 19.947847, 18.035637,
4.766045, 35.260029), 500.303619 = c(71.055733, 71.633324,
52.946838, 5.423041, 46.464863, 6.588941, 36.934429, 8.375227,
11.509252, 52.112522), 550.619446 = c(50.106739, 50.130459,
98.209206, 4.198293, 107.08017, 3.285105, 116.544121, 2.680266,
75.533684, 109.890892), 600.445679 = c(84.085876, 84.222191,
93.014145, 5.128644, 99.761459, 8.127449, 108.144485, 11.041065,
61.032551, 96.012955), 650.055603 = c(112.020103, 111.172882,
74.847755, 39.078632, 79.481064, 46.994965, 81.969803, 50.675137,
36.563408, 72.147202), 700.022278 = c(123.58625, 124.230499,
110.486763, 106.907661, 113.815315, 105.082329, 126.449547, 105.5476,
79.527557, 112.168938)), class = "data.frame", row.names = c(NA,
-10L))

And here's a minimal reproducible code:

library(factoextra)
library(FactoMineR)
res<-PCA(df)
fviz_pca_var(res)

So I would like to color the variables according to their numerical values with the parameter col.var .

Thank you.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.