简体   繁体   English

在 R 中使用 factoextra 更改补充列的颜色

[英]Change colour of supplementary column using factoextra in R

I am trying to change the colour used for the supplementary column in a correspondence analysis using fviz_ca_col() from the package factoextra , but I do not seem to get any response when changing the colour from the default col.col.sup = "darkred" .我正在尝试使用 package factoextra 中的fviz_ca_col()在对应分析中更改用于补充列的颜色,但是从默认col.col.sup col.col.sup = "darkred"更改颜色时我似乎没有得到任何响应. Reproducible example:可重现的例子:

library(FactoMineR)
library(factoextra)

# Load example data
data("housetasks")

# Perform correspondence analysis
resca <- CA(housetasks, 
                 col.sup = which(names(housetasks) == "Alternating"),  
                 graph = FALSE)

# Call to plot
fviz_ca_col(resca, col.col.sup = "black")

The resulting plot has the supplementary column "Alternating" in the default dark red colour:生成的 plot 具有默认深红色的补充列"Alternating"

在此处输入图像描述

There's a bug in the source code : 源代码中有一个错误:

fviz (X, element = "col", axes = axes, geom = geom.col,
        color = col.col, alpha = alpha.col,
        pointshape = shape.col, select = select.col, 
        map = map, repel = repel, 
        colcol.sup = col.col.sup, shape.sup = shape.col, ...)

The input parameter should be col.col.sup = instead of colcol.sup =输入参数应该是col.col.sup =而不是colcol.sup =

One way is to call fviz:一种方法是调用 fviz:

fviz(resca,element="col",col.col.sup="black")

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM