From the above plot I want to remove labels displayed in the middle of each line and only keep labels at the starting and end of lines, but do not know how to do that. Below is the complete code of my plot.
income_data %>%
drop_na(quarter) %>%
ggplot(aes(x = q_year, y = household_final_consumption_expenditure, group = quintile, color = quintile))+
geom_point()+
geom_line()+
labs(title = "Household Final Consumption Expenditure 2019-2020",
caption = "Source: Statistics Canada",
x = "",
y = "")+
theme(axis.text.y = element_blank(),
axis.ticks.y = element_blank())+
ggrepel::geom_text_repel(aes(label = household_final_consumption_expenditure))
Sample data
structure(list(q_year = c("Q 1 2020", "Q 2 2020", "Q 3 2020",
"Q 1 2020", "Q 2 2020", "Q 3 2020", "Q 1 2020", "Q 2 2020", "Q 3 2020",
"Q 1 2020", "Q 2 2020", "Q 3 2020"), quintile = structure(c(1L,
1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("Lowest income quintile",
"Second income quintile", "Third income quintile", "Fourth income quintile",
"Highest income quintile"), class = "factor"), household_final_consumption_expenditure = c(15050,
13932, 15660, 15460, 14580, 16415, 18285, 17095, 19484, 21124,
19531, 22436)), row.names = c(NA, -12L), class = c("tbl_df",
"tbl", "data.frame"))
Hope this sample data is enough. Do let me know in comments if anything else is required.
Desired plot
Please suggest some ideas for this.