我想根据我的选择分配颜色;
resp <- data.frame(replicate(50, sample(1:7, 100, replace=TRUE)))
resp <- data.frame(lapply(resp, factor, ordered=TRUE,
levels=1:7,
labels=c("Missing","Not Applicable","Strongly disagree","Disagree", "Neutral","Agree","Strongly Agree")))
resp = t(apply(resp,2,table))[,levels(resp[,1])]
我不想使用diverge_hcl或sequential_hcl。
library(HH)
myColor <- likertColor(nc=7, ReferenceZero=5)
plot.likert(resp,as.percent=TRUE,col=myColor)
我有两个额外的名为&#34; Missing&#34;和&#34;不适用&#34;。 我需要一个与类别相关的配色方案,例如: -
有没有想过如何将上面的配色方案应用到我的情节中?
答案 0 :(得分:0)
简单的答案是:
myColor <- c("light gray","gray","blue","light blue","white","pink","red")
plot.likert(resp,as.percent=TRUE,col=myColor)
答案 1 :(得分:0)
还可以在十六进制中使用RGB:
plot.likert(resp,as.percent=TRUE,
col=c("#E94E1B", "#F7AA4E", "#BEBEBE", "#6193CE", "#00508C"))