'geom_label_repel to display labels in ggplot
I am trying to plot a graph using the geom_label_repel function to show the country label next to each line. I am not sure why, but for Sweden (orange line), the label is not showing next to the line: 
Would be so happy for any tips! Thank you!
Here is the code I used so far:
# create label for plot
df_YouGov5$label[which(df_YouGov5$DATE2 == max(df_YouGov5$DATE2))] <- df_YouGov5$COUNTRY[which(df_YouGov5$DATE2 == max(df_YouGov5$DATE2))]
# ggplot
ggplot(df_YouGov5, aes(x=DATE2, y=PERCENT, group=COUNTRY))+
geom_smooth(method = "auto", se = FALSE, aes(col=COUNTRY), size = 0.71)+
theme_light()+
labs(col = "COUNTRY",
title = "% of people in each country who think the government is handling the issue of the coronavirus 'very' or 'somewhat' well",
x = "",
y = "",
caption = "Source: Imperial College London YouGov Covid 19 Behaviour Tracker")+
theme(legend.position = "none",
plot.title = element_text(face="bold", size = 20),
axis.text = element_text(size = 15),
axis.title = element_text(size = 15),
plot.caption = element_text(hjust = 0, size = 15))+
scale_y_continuous(breaks = seq(0,100, by=10), label = label_number(suffix = "%"))+
scale_color_npg()+
scale_x_discrete(labels = c("May-20", "Jun-20", "Jul-20", "Aug-20", "Sept-20", "Oct-20", "Nov-20", "Dec-20",
"Jan-21", "Feb-21", "Mar-21", "Apr-21", "May-21", "Jun-21", "Jul-21", "Aug-21", "Sept-21", "Oct-21", "Nov-21", "Dec-21",
"Jan-22", "Feb-22", "Mar-22"))+
theme(axis.text.x = element_text(angle=45, hjust = 1))+
geom_label_repel(aes(label = label),
size = 6) ```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
