I am using the likert package in R to plot this graph:
The labels on the horizontal axis are incorrect. What is plotted are percentages. How can I add a percentage sign to the positions indicated in the screenshot?
library("likert")
library("scales")
d <- likert(d)
plot(d, col=myColor) +
ggtitle("Mechanical Turk") +
theme(text = element_text(size=20)) +
# scale_x_discrete(labels=percent) +
# scale_y_discrete(labels=percent) +
# scale_y_discrete(breaks=c("A","B","C","D","E")) +
# scale_y_discrete(labels=c("100" = "100%", "50" = "50%","0" = "0%")) +
ylab("Percentage of all responses")
I've tried adding scale_x_discrete(labels=percent)
but that gave an error ("Error in x * scale : non-numeric argument to binary operator"). The comments show the other things I have tried.
There is a coord_flip() on the likert plot (see likert.bar.plot
). try the below:
library(likert)
library(ggplot2)
data(pisaitems)
items29 <- pisaitems[,substr(names(pisaitems), 1,5) == 'ST25Q']
names(items29) <- c("Magazines", "Comic books", "Fiction",
"Non-fiction books", "Newspapers")
l29 <- likert(items29)
plot(l29) + scale_y_continuous(labels=c("100%","50%","0%","50%","100%"),limits=c(-105,105))