-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_parameters_ts.R
More file actions
23 lines (22 loc) · 1.07 KB
/
plot_parameters_ts.R
File metadata and controls
23 lines (22 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(ggplot2)
library(patchwork)
library(dplyr)
library(tidyverse)
plot_parameters_ts<- function(team,complete_df,start=19,end=38){
plot<- complete_df%>% filter(Team==team & Matchday >= start & Matchday <= end) %>%
ggplot( aes(x = Matchday, y = Mean, ymin = Lower, ymax = Upper, fill = Type))+
geom_line(aes(color = Type), linewidth = 1) +
geom_point()+
geom_ribbon(aes(fill = Type), alpha = 0.20) +
labs(title = paste0(team," abilities over time"), x = "Matchday", y = "Coefficient") +
scale_color_manual(values = c("blue", "red")) + # Specify colors for attack and defence
scale_fill_manual(values = c("blue","red")) + # Hide the legend for fill
theme_minimal()+
theme(#axis.title.x = element_text(size=12, face="bold", colour = "black"),
#axis.text.x = element_text(size=10, face="bold", colour = "black"),
#axis.title.y = element_text(size=12, face="bold", colour = "black"),
#axis.text.y = element_text(size=10, face="bold", colour = "black"),
plot.title = element_text(hjust = 0.5,face = "bold")
)
return(plot)
}