I am trying to draw a biplot using the function fviz_pca_biplot. I would like to see how the replicates (I have two/three replicates for every variety) in three different treatments behave.
I have two/three replicates (Rep) for every variety. I would like to know if it is possible to have two level to draw the plot:
a first one to define the variety, by shape of the point (every point is a replicate).
one level to define the treatment by the color used for fillment of the point.
Here is an example of my data set, my complete data set that I want to use for the biplot has in total 153 observation and 30 variables:
"Treatment" "Variety" "Rep" "ARI" "NDVI_1"
"Heat" "5" 5 0.8 0.6
"Heat" "5" 5 -0.3 0.65
"Drought" "5" 80 -0.7 0.67
"Drought" "5" 80 -0.09 0.79
"Control" "5" 182 -0.09 0.76
"Control" "5" 182 0.04 0.97
"Heat" "7" 7 0.8 0.6
"Heat" "7" 7 -0.3 0.65
"Drought" "7" 85 -0.7 0.67
"Drought" "7" 85 -0.09 0.79
"Control" "7" 186 -0.09 0.76
"Control" "7" 186 0.04 0.97
Looking at previous answers on internet, I tried to proceed with this code to differentiate the treatment, however, I did not get any results.
In addition, I do not have any idea on how to group by variety to get a different symbol for every variety.
all.data_1<-all.data[, -c(1)]# to delete column `Treatment` that is character
res.pca <- prcomp(all.data_1, scale = TRUE)
fviz_pca_biplot(res.pca, label = "var", habillage=all.data$Treatment,
addEllipses=TRUE, ellipse.level=0.95,
ggtheme = theme_minimal())