I have a ggplot made of a likert-scale using the package likert by jason.bryer (see). If you run the code with the original data here, then my extrem label (in the far right) i
So first of all, while the far right elements of the legend do not display, they do render properly in the pdf.
The problem is that the legend is just too long, so it gets clipped. One option of course is to just make the display window larger. Another is to make the legend smaller. You can do that by adding one line to the end of the definition of p:
p <- plot(competence_bachelor_plot, centered = FALSE, include.histogram = FALSE) +
ggtitle("How do you rate your skills gained with the Bachelor's?*") +
theme(axis.text.y = element_text(colour = "black"), axis.text.x = element_text(colour = "black"))+
theme(legend.key.size=unit(.01,"npc"))
You can also remove the name ("Response"), since it's redundant and disturbs the symmetry. This also allows you to make the legend itself larger.
p <- plot(competence_bachelor_plot, centered = FALSE, include.histogram = FALSE) +
ggtitle("How do you rate your skills gained with the Bachelor's?*") +
theme(axis.text.y = element_text(colour = "black"), axis.text.x = element_text(colour = "black"))+
theme(legend.key.size=unit(0.02,"npc"))+guides(fill=guide_legend(""))
You could also make the legend two rows, which would create ample room:
guides(fill = guide_legend(nrow = 2))
p <- plot(competence_bachelor_plot,
centered = FALSE,
include.histogram = FALSE) +
ggtitle("How do you rate your skills gained with the Bachelor's?*") +
theme(axis.text.y = element_text(colour = "black"),
axis.text.x = element_text(colour = "black"),
plot.margin = unit(c(2, 2, 2, 2), "cm"))