如何更改 factoextra 包中列元素图贡献的 y 标签

How to change the y label of contributions of column elements plot in factoextra package

当我用fviz_contrib绘制factoextra包中列元素的贡献时,y标签默认是Contributions(%),请问如何改成其他文字

我使用了以下代码:

library(factoextra)
library(FactoMineR)
# Principal component analysis
# ++++++++++++++++++++++++++
data(decathlon2)
decathlon2.active <- decathlon2[1:23, 1:10]
res.pca <- prcomp(decathlon2.active,  scale = TRUE)

# variable contributions on axis 1
fviz_contrib(res.pca, choice="var", axes = 1, top = 10, ylab = 'my label y' )

然而,它提示了我

Error in ggpubr::ggbarplot(df, x = "name", y = "contrib", fill = fill, : formal argument "ylab" matched by multiple actual arguments

如何解决这个问题?

谢谢。

您可以为此使用以下代码

# variable contributions on axis 1
library(ggpubr)
p <- fviz_contrib(res.pca, choice="var", axes = 1, top = 10) 
ggpar(p, ylab = 'my label y')