I have a dataframe of scores
scores <- data.frame(var1=c(1,3,5,6,1,4,10,2,5,3,7), var2=c(10,9,1,4,3,3,4,7,8,10,10))
which I transform into a factor with three levels as:
library(likert)
library(dplyr)
scores_factor <- scores %>% sapply(., cut, c(0, 6, 8, 10), include.lowest = TRUE, labels = c("Negative", "Okay", "Positive")) %>% data.frame
and then transforming it into a likert item and plotting it using the likert.plot from the "likert" package:
likert_scores <- likert(scores_factor)
p <- plot(likert_scores,
low.color="#ED5949",
neutral.color="#F3CA71",
high.color="#7CB166") +
labs(title= "Hello world!") +
theme(plot.title=element_text(size=16,
face="bold", color="black"),
plot.subtitle=element_text(size=11,
face="italic", color="black"),
text = element_text(color = "#333333",
axis.text.x=element_blank(),
legend.position="right") +
theme_hc()
plot(p)
Now, the problem is that the likert.plot displays the edge value labels not inside the bars. I wish to find a way to print the labels inside the bars without having to resort on building a stacked barplot from scratch with ggplot2? Is this possible? If not what could be an alternative?