我使用的是likert包。
我的绘图看起来像软件包制作的标准绘图,可以在官方的likert软件包页面上看到(http://jason.bryer.org/likert/)
我的问题是:是否有可能影响、手动更改图例标签(热图中的"百分比"以及天平中的"百分数"one_answers"响应"?)
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包以及
只要likert.heat.plot(..)
返回ggplot
类的对象,就可以用标准的ggplot2
指令进行处理。因此,图例标题可以通过以下方式更改:
plot(l28, type = "heat") + guides(fill=guide_legend(title="Prozent"))