Add charts.R file and Presentation folder with charts images
This commit is contained in:
parent
7011bb8892
commit
740ce77f42
Binary file not shown.
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
Prezentacja/dane.PNG
Normal file
BIN
Prezentacja/dane.PNG
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
104
charts.R
Normal file
104
charts.R
Normal file
@ -0,0 +1,104 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(ggpubr)
|
||||
library(ggthemes)
|
||||
install.packages("gridExtra")
|
||||
library("gridExtra")
|
||||
install.packages("cowplot")
|
||||
library("cowplot")
|
||||
|
||||
|
||||
lech <- read.csv(file = "C:\\Users\\Lenovo\\Desktop\\MGR\\analiza_danych_sportowych\\ADS\\preprocessed_data\\club-lech-preprocessed.csv", fileEncoding = "utf-8", head = TRUE, sep=",")
|
||||
legia <- read.csv(file = "C:\\Users\\Lenovo\\Desktop\\MGR\\analiza_danych_sportowych\\ADS\\preprocessed_data\\club-legia-preprocessed.csv", fileEncoding = "utf-8", head = TRUE, sep=",")
|
||||
piast <- read.csv(file = "C:\\Users\\Lenovo\\Desktop\\MGR\\analiza_danych_sportowych\\ADS\\preprocessed_data\\club-piast-preprocessed.csv", fileEncoding = "utf-8", head = TRUE, sep=",")
|
||||
pogon <- read.csv(file = "C:\\Users\\Lenovo\\Desktop\\MGR\\analiza_danych_sportowych\\ADS\\preprocessed_data\\club-pogon-preprocessed.csv", fileEncoding = "utf-8", head = TRUE, sep=",")
|
||||
|
||||
View(lech)
|
||||
|
||||
lech <- transform(lech, Frekwencja = as.numeric(Frekwencja))
|
||||
legia <- transform(legia, Frekwencja = as.numeric(Frekwencja))
|
||||
piast <- transform(piast, Frekwencja = as.numeric(Frekwencja))
|
||||
pogon <- transform(pogon, Frekwencja = as.numeric(Frekwencja))
|
||||
|
||||
lech$Data = as.Date(lech$Data, format="%d.%m.%Y")
|
||||
legia$Data = as.Date(legia$Data, format="%d.%m.%Y")
|
||||
piast$Data = as.Date(piast$Data, format="%d.%m.%Y")
|
||||
pogon$Data = as.Date(pogon$Data, format="%d.%m.%Y")
|
||||
|
||||
sezon_lech <- filter(lech, Graj¹.u.siebie == "1", Sezon == "1")
|
||||
sezon_legia <- filter(legia, Graj¹.u.siebie == "1", Sezon == "1")
|
||||
sezon_piast <- filter(piast, Graj¹.u.siebie == "1", Sezon == "1")
|
||||
sezon_pogon <- filter(pogon, Graj¹.u.siebie == "1", Sezon == "1")
|
||||
|
||||
|
||||
lech_u_siebie <- filter(lech, Graj¹.u.siebie == "1")
|
||||
|
||||
View(lech_u_siebie)
|
||||
|
||||
result_colors <- c('#d9261e','#69d100', '#69d1cd')
|
||||
|
||||
|
||||
# Wykres liniowy przedstawiaj¹cy frekwencjê Lecha na swoim stadionie z oznaczeniem rezulatów spotkañ
|
||||
plot1 <- ggplot(data = lech_u_siebie, aes(x = Data, y = Frekwencja, group = 1, color = as.factor(Wygrana))) +
|
||||
geom_point(size = 2) +
|
||||
scale_color_manual(values=result_colors, labels = c("Przegrana", "Zwyciêstwo", "Remis")) +
|
||||
geom_line() +
|
||||
theme(axis.text.x = element_text(angle = 15, vjust = 0.5, hjust=1), axis.title.x = element_blank()) +
|
||||
labs(color = "Rezultat spotkania") +
|
||||
ggtitle("Frekwencja Lecha Poznañ na swoim stadionie w latach 2016-2019") +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%b %Y")
|
||||
|
||||
show(plot1)
|
||||
|
||||
# Wykres liniowy przedstawiaj¹cy frekwencjê Lecha, Legii, Piasta i Pogoni w meczach rozgrywanych na swoim stadionie w sezonie YYYY
|
||||
lech_plot <- ggplot(data = sezon_lech, aes(x = Data, y = Frekwencja, group = 1, color = as.factor(Wygrana), alpha=0.5)) +
|
||||
geom_point(size = 3) +
|
||||
theme(axis.title.x = element_blank(), axis.title.y = element_blank()) +
|
||||
scale_color_manual(values=result_colors) +
|
||||
geom_line(size = 1) + theme(legend.position="none") +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
legia_plot <- ggplot(data = sezon_legia, aes(x = Data, y = Frekwencja, group = 1, color = as.factor(Wygrana), alpha=0.5)) +
|
||||
geom_point(size = 3, alpha=0.5) +
|
||||
theme(axis.title.x = element_blank(), axis.title.y = element_blank()) +
|
||||
scale_color_manual(values=result_colors) +
|
||||
geom_line(size = 1) + theme(legend.position="none") +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
piast_plot <- ggplot(data = sezon_piast, aes(x = Data, y = Frekwencja, group = 1, color = as.factor(Wygrana), alpha=0.5)) +
|
||||
geom_point(size = 3, alpha=0.5) +
|
||||
theme(axis.title.x = element_blank(), axis.title.y = element_blank()) +
|
||||
scale_color_manual(values=result_colors) +
|
||||
geom_line(size = 1) + theme(legend.position="none") +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
pogon_plot <- ggplot(data = sezon_pogon, aes(x = Data, y = Frekwencja, group = 1, color = as.factor(Wygrana), alpha=0.5)) +
|
||||
geom_point(size = 3, alpha=0.5) +
|
||||
theme(axis.title.x = element_blank(), axis.title.y = element_blank()) +
|
||||
scale_color_manual(values=result_colors) +
|
||||
geom_line(size = 1) + theme(legend.position="none") +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
plot_grid(lech_plot, legia_plot, piast_plot, pogon_plot,
|
||||
labels=c("Lech Poznañ", "Legia Warszawa", "Piast Gliwice", "Pogoñ Szczecin"),
|
||||
ncol = 2, nrow = 2)
|
||||
|
||||
# Mecze Lecha Poznañ rozegrane na swoim stadionie w sezonach 2016/2019 z uwzglêdnieniem godziny i dnia tygodnia
|
||||
plot2 <- ggplot(lech_u_siebie, aes(x=Data, y=Dzieñ.tygodnia, color=Godzina, size=Frekwencja)) +
|
||||
geom_point(alpha=0.5) +
|
||||
scale_size(range = c(3, 30)) +
|
||||
theme(axis.text.x = element_text(angle = 20, vjust = 0.5, hjust=1), axis.title.x = element_blank()) +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
show(plot2)
|
||||
|
||||
# Mecze Lecha Poznañ rozegrane na swoim stadionie w sezonach 2016-2019 z uwzglêdnieniem Temperatury
|
||||
plot3 <- ggplot(lech_u_siebie, aes(x=Data, y=Temperatura, color=Godzina, size=Frekwencja)) +
|
||||
geom_point(alpha=0.5) +
|
||||
scale_size(range = c(0, 15)) +
|
||||
theme(axis.text.x = element_text(angle = 30, vjust = 0.5, hjust=1), axis.title.x = element_blank()) +
|
||||
scale_x_date(date_breaks = "1 month", date_labels = "%m.%Y")
|
||||
|
||||
show(plot3)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user