I have a dataset of all football (soccer) transfers made in the last fifteen seasons. I am doing a regression analysis with the placement of the teams. I am plotting the lines via geom_smooth for all of the five respective leagues. I have chosen to categorise the seasons into five steps, => five colours in total. In the end, I want to label the plots directly in the plot. Using geom_dl, I was only able to plot at the last remaining point.
The code I used is the following:
pal <- c("05/06" = "red","06/07" = "red","07/08" = "red","08/09" = "blue","09/10" = "blue","10/11" =
"blue","11/12" = "black","12/13" = "black","13/14" = "black","14/15" = "yellow","15/16" =
"yellow","16/17" = "yellow","17/18" = "forestgreen","18/19" = "forestgreen","19/20" = "forestgreen")
Reg_Ger <- lm(Placement ~ Transfer_Expenditure, data = DS_Ger)
summary(Reg_Ger)
ggplot(aes(x=Transfer_Expenditure ,y=Placement, colour = Season, fill=Season),data = DS_Ger)+
ggtitle("Bundesliga")+
geom_point(size=2)+
scale_y_continuous(limits = c(1, 18), breaks = seq(1, 18, by = 1))+
scale_x_continuous(limits = c(0, 150000000), breaks = seq(0, 150000000, by = 40000000))+
scale_colour_manual(values = pal)+
geom_smooth(method = "lm",se=F)+
theme_dark()
geom_dl(aes(label=Season),method=list("last.points"))
I also tried using GGrepel, but that gives me the season for all points in the plot, which I do not need/want.
If anyone can help me, that would be great, I searched a long for a solution but did not find any.
PS: If someone can explain these error messages to me that would also be great (not a big issue): Warning messages:
1: Removed 8 rows containing non-finite values (stat_smooth).
2: Removed 8 rows containing missing values (geom_point).
3: Removed 101 rows containing missing values (geom_smooth).