【问题标题】:How to change the y label of contributions of column elements plot in factoextra package如何在factoextra包中更改列元素图贡献的y标签
【发布时间】:2020-08-26 06:07:47
【问题描述】:

当我使用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' )

但是,它提示了我

ggpubr::ggbarplot(df, x = "name", y = "contrib", fill = fill, 中的错误: 由多个实际参数匹配的形式参数“ylab”

如何解决?

谢谢。

【问题讨论】:

    标签: r pca


    【解决方案1】:

    您可以使用以下代码

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

    【讨论】:

    • 它有效,谢谢。其他factoextra函数可以直接在函数中使用ylab = 'my y label' ,为什么这个不起作用?
    猜你喜欢
    • 1970-01-01
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    相关资源
    最近更新 更多