1

i am using the likert package.

my plots look like the standard plots produced by the packages as can be seen on the official likert package page (http://jason.bryer.org/likert/)

my question: is it possible to influence, manually change the legend labels ("Percent" in the heat map and "Percentage" and "Response" in the scales?)

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")

(the sample from the likert site, it will produce a heat plot with the percentage expression in the color key legend)

edit: i was trying:

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

but it won´t run likert.heat.plot(128) is not running as well, which is weird because

plot(128, type = "heat") 

is. i loaded the ggplot2 package in addition

alx.chrs
  • 127
  • 3
  • 15
  • Could you add a small, reproducible sample of code? – lawyeR Mar 03 '15 at 10:59
  • code now in the edit. – alx.chrs Mar 03 '15 at 12:05
  • An idea: Since plot in the likert package calls in your situation likert.heat.plot, you might create a variant of the latter. In the variant plotting function you could change the name of the legend using the usual ggplot2 technique: scale_[whatever]_discrete(name="[legend name]") chocolate!?") – lawyeR Mar 03 '15 at 14:10
  • update in edit of orig. post. thx for your time. – alx.chrs Mar 04 '15 at 08:43

1 Answers1

1

As far as likert.heat.plot(..) returns an object of class ggplot, then it can be processed with standard ggplot2 instructions. Thus, the legend title can be changed by:

plot(l28, type = "heat") + guides(fill=guide_legend(title="Prozent")) 
DzimitryM
  • 561
  • 1
  • 5
  • 13