我有一个过去十五个赛季中所有足球(足球)转会的数据集。我正在对团队的位置进行回归分析。我正在通过 geom_smooth 为所有五个各自的联赛绘制线条。我选择将季节分为五个步骤,=> 总共五种颜色。最后,我想直接在情节中标记情节。使用 geom_dl,我只能在最后一个剩余点进行绘图。
我使用的代码如下:
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"))
我也尝试使用 GGrepel,但这给了我情节中所有点的季节,我不需要/不想要。
如果有人可以帮助我,那就太好了,我搜索了很长时间的解决方案,但没有找到任何解决方案。
PS:如果有人可以向我解释这些错误消息,那也很好(不是大问题):警告消息:
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).