1

我正在使用 likert 包。

我的地块看起来像包产生的标准地块,可以在官方的 likert 包页面 ( http://jason.bryer.org/likert/ )上看到

我的问题:是否可以影响、手动更改图例标签(热图中的“百分比”和比例中的“百分比”和“响应”?)

library(likert)
data(pisaitems)

items28 <- pisaitems[, substr(names(pisaitems), 1, 5) == "ST24Q"]
head(items28)


ncol(items28)


items28 <- rename(items28, c(ST24Q01 = "I read only if I have to.", ST24Q02 = "Reading is one of my favorite hobbies.", 
                         ST24Q03 = "I like talking about books with other people.", ST24Q04 = "I find it hard to finish books.", ST24Q05 = "I feel happy if I receive a book as a present.", 
                         ST24Q06 = "For me, reading is a waste of time.", ST24Q07 = "I enjoy going to a bookstore or a library.", ST24Q08 = "I read only to get information that I need.", 
                         ST24Q09 = "I cannot sit still and read for more than a few minutes.", ST24Q10 = "I like to express my opinions about books I have read.", 
                         ST24Q11 = "I like to exchange books with my friends"))



l28 <- likert(items28)
summary(l28)
plot(l28, type = "heat")

(来自 likert 网站的样本,它将生成一个热图,其中包含颜色键图例中的百分比表达式)

编辑:我正在尝试:

likert.heat.plot(128) + scale_fill_hue(name="Prozent")

但它不会运行 likert.heat.plot(128) 也没有运行,这很奇怪,因为

plot(128, type = "heat") 

是。我还加载了 ggplot2 包

4

1 回答 1

1

至于likert.heat.plot(..)返回一个类的对象ggplot,那么它可以用标准ggplot2指令处理。因此,可以通过以下方式更改图例标题:

plot(l28, type = "heat") + guides(fill=guide_legend(title="Prozent")) 
于 2020-03-30T12:03:29.917 回答