I would like to get/plot the contribution of the features for each type of wine class(barolo, grignolino, barbera). With fviz_contrib I get the contribution over all classes, as shown in the MWE below. However I was wondering if and how it is possible to calculate/plot them individually filtered by classes/groups.
library(ggbiplot)
library(factoextra)
data(wine)
wine.pca <- prcomp(wine, scale. = TRUE)
# plot the PCA
print(ggbiplot(wine.pca, obs.scale = 1, var.scale = 1, groups = wine.class, ellipse = TRUE, circle = TRUE))
# plot the contributions of the features for all wine classes
g.contr <- fviz_contrib(wine.pca, choice = "var", axes = 1:2, fill = "lightblue", color = "darkblue", top = 45)
print(g.contr)