What insights can we gain about the top-performing FIFA players, their identity, physical characteristics, and the relationship between value and performance? Here we will explore the influences that affect players’ performance (overall goals scored with Finishing as variable) and Value.

Visualization 1 An overview

library(ggplot2)
library(dplyr)
library(hrbrthemes)
library(viridis)
library(ggrepel)
library(ggthemes)
fifa_data <- readr::read_csv("/Users/jiayaokun/Desktop/fifa_data.csv") 

data <- fifa_data %>% filter(`Contract Valid Until`>2020) 
  
data$Age_Group <- cut(data$Age, breaks = seq(16, 45, length.out = 8), labels = FALSE)
age_color_scale <- c("#faffc6", "#eca680", "#D96558",  "#692F7c","#B43970", "#282A62","#54beaa","black")

# Plot with grouped ages and custom colors
g <- ggplot(data, aes(x = Finishing, fill = factor(Age_Group))) +
  geom_histogram(color = "#F6C63c",bins = 20) +
  scale_fill_manual(values = age_color_scale,
                    name = "Age group",
                    labels = c("16-19", "20-23", "24-27","28-31","32-35","36-39","40-45","50+")) +
  labs(title = expression(bold("Distribution of Finishing Scores by Age Group")),
       x = "Finishing",
       y = "COUNT",
       fill = "Age Group") +
  theme_minimal()+
  theme(panel.background = element_rect(fill = "#fcf1f0"),
        legend.key.size = unit(0.4, "cm"))

### h

convert_to_numeric <- function(input_vector) {
  cleaned_vector <- sub("€", "", input_vector)
  
  numeric_values <- ifelse(grepl("M$", cleaned_vector),
                           as.numeric(sub("M$", "", cleaned_vector)) * 1e6,
                           ifelse(grepl("K$", cleaned_vector),
                                  as.numeric(sub("K$", "", cleaned_vector)) * 1e3,
                                  as.numeric(cleaned_vector)))
  return(numeric_values)}


fifa_data$Value_numeric <- convert_to_numeric(fifa_data$Value)

data <- fifa_data %>% filter(`Contract Valid Until`>2020)  
data$Age_Group <- cut(data$Age, breaks = seq(16, 45, length.out = 8), labels = FALSE)

age_color_scale <- c("#faffc6", "#eca680", "#D96558",  "#692F7c","#B43970", "#282A62","#54beaa","black")


h <- ggplot(data, aes(x = Value_numeric, fill=factor(Age_Group))) + 
  geom_histogram(color = "#F6C63c",bins = 20) +
  scale_fill_manual(values = age_color_scale,
                    name = "Age group",
                    labels = c("16-19", "20-23", "24-27","28-31","32-35","36-39","40-45","50+")) +
  scale_x_log10(labels = scales::label_number_si())+
  labs(title = expression(bold("Distribution of Players' value by Age Group")),
       x = "Players' value(€)",
       y= NULL,
       fill = "Age Group") +
  theme_minimal()+ 
  theme(panel.background = element_rect(fill = "#fcf1f0"),
        legend.key.size = unit(0.4, "cm"))

#### m
library(dplyr)
convert_to_numeric <- function(input_vector) {
  cleaned_vector <- sub("€", "", input_vector)
  
  numeric_values <- ifelse(grepl("M$", cleaned_vector),
                           as.numeric(sub("M$", "", cleaned_vector)) * 1e6,
                           ifelse(grepl("K$", cleaned_vector),
                                  as.numeric(sub("K$", "", cleaned_vector)) * 1e3,
                                  as.numeric(cleaned_vector)))
  return(numeric_values)}


fifa_data$Value_numeric <- convert_to_numeric(fifa_data$Value)
data <- fifa_data %>% filter(`Contract Valid Until` > 2020)


top_50 <- data %>% 
  top_n(50, wt = Value_numeric)

custom_colors <- c(
  "Wales" = "#EFA143","Uruguay" = "#EFA143", "Slovenia" = "#EFA143", "Slovakia" = "#EFA143",
  "Serbia" = "#EFA143","Poland" = "#EFA143","Netherlands" = "#EFA143","Gabon" = "#EFA143", "Egypt" = "#EFA143",
  "Croatia" = "#EFA143", "Colombia" = "#EFA143","Senegal" = "#D96558","Portugal" = "#D96558","England" = "#D96558",
  "Italy" = "#B43970","Belgium" = "#B43970","Spain" = "#692F7C","Germany" = "#282A62","Brazil" = "#282A62", "Argentina" = "#282A62",
  "France" = "#282A62")

m <- ggplot(data = top_50, aes(x = Nationality,fill = Nationality,color = Nationality)) +
  geom_bar(position = "dodge") +
  coord_flip()+
  scale_color_manual(values = custom_colors,guide = "none") +
  scale_fill_manual(values = custom_colors,guide = "none")+
  theme_bw() +
  labs(title = expression(bold("Nationality distribution of top 50 players ranked in Value")),
       x = NULL,
       caption = "Source:https://www.kaggle.com/datasets/mahmoudshogaa/fifa-data ")

### n
custom_colors_club <- c(
  "Tottenham Hotspur" = "#EFA143","Milan" = "#EFA143", "Chelsea" = "#EFA143", 
  "Napoli" = "#D96558","Manchester United" = "#D96558","Lazio" = "#D96558","Inter"= "#D96558",
  "Arsenal" = "#D96558","Paris Saint-Germain" = "#B43970","Juventus"= "#B43970","Atlético Madrid"= "#B43970",
  "Liverpool" ="#af8fd0","Manchester City" = "#692F7C","FC Bayern München" = "#692F7C","Real Madrid" = "#282A62","FC Barcelona" = "#282A62")

n <- ggplot(data = top_50, aes(x = Club,fill = Club,color = Club)) +
  geom_bar(position = "dodge") +
  coord_flip()+
  scale_color_manual(values = custom_colors_club,guide = "none") +
  scale_fill_manual(values = custom_colors_club,guide = "none")+
  theme_bw() +
  labs(title = expression(bold("Club distribution of top 50 players ranked in Value")),
       x = NULL,
       caption = "Source:https://www.kaggle.com/datasets/mahmoudshogaa/fifa-data ")

library(Rmisc)
multiplot(g,m,h,n,cols = 2)

This visualization is a general description of the identity of the top 50 players in terms of Value and Finishing (goals scored). This visualization contains four separate graphs outlining the distribution of nationalities and clubs of the Top 50 soccer players in the dataset. It helps the viewer to understand the range and concentration of the Top 50 players’ value and overall goals scored.

Visualization 2 Height & Weight Distribution of Players

data <- fifa_data %>% filter(`Contract Valid Until`>2020)  

data %>%
  ggplot(aes(x = Height, y = Weight, size = Finishing, color = `Preferred Foot`,fill = `Preferred Foot`,shape = `Preferred Foot`)) +
  geom_point(alpha = 0.7) +
  geom_text_repel(data = subset(data, Finishing > 90), mapping = aes(label = Name),color = "black") + 
  ylab("Weight(lbs)") +
  xlab("Height(feet'inches)") +
  scale_size_continuous(name = "Finishing", labels = scales::comma) + 
  scale_color_manual(values = c("#b0d992","#af8fd0"),guide = "none") +  
  scale_fill_manual(values = c("#b0d992","#af8fd0"),guide = "none") +
  scale_shape_manual(values = c("Left" = 16, "Right" = 17), 
                     name = "Play numbers",  
                     labels = c("1630 Left", "6256 Right")) + 
  facet_wrap(~ `Preferred Foot`) +
  theme_bw() +
  labs(x = "Height(feet'inches)", y = "Weight(lbs)",
       title = expression(bold("Height & Weight Distribution of Players (Facet by Preferred Foot)")),
       subtitle = "Only players with contracts valid until 2020 onwards are displayed \nOnly players with an individual goal tally greater than 90 are marked ",
       caption = "Source:https://www.kaggle.com/datasets/mahmoudshogaa/fifa-data") +
  theme(axis.title.x = element_text(hjust = 0.5),
        axis.title.y = element_text(hjust = 0.5),
        strip.background.x = element_rect(fill = "#eff4fb"),
        legend.key.size = unit(1, "cm")) 

This scatterplot depicts the relationship between players’ height and weight, and compares groups whose dominant foot is left-footed separately from those right-footed. The viewer can understand the general distribution and trend of the players’ physical characteristics. And to have a more accurate range I only selected players whose contracts are valid until 2020 and beyond. I have also highlighted players who have scored more than 90 goals.

Visualization 3 Total Finishing & Players’ value plot.

convert_to_numeric <- function(input_vector) {
  cleaned_vector <- sub("€", "", input_vector)
  
  numeric_values <- ifelse(grepl("M$", cleaned_vector),
                           as.numeric(sub("M$", "", cleaned_vector)) * 1e6,
                           ifelse(grepl("K$", cleaned_vector),
                                  as.numeric(sub("K$", "", cleaned_vector)) * 1e3,
                                  as.numeric(cleaned_vector)))
  return(numeric_values)}


fifa_data$Value_numeric <- convert_to_numeric(fifa_data$Value)

new_data <- fifa_data %>% filter(`Contract Valid Until`>2020, Finishing >10) 

custom_colors_p <- c(
  "CAM" = "#EFA143","CB" = "#EFA143", "CDM" = "#EFA143", "CM" = "#EFA143",
  "CF" = "#EFA143","Poland" = "#EFA143","GK" = "#D96558","LAM" = "#B43970","LB" = "#B43970","LCB" = "#B43970","LCM" = "#B43970",
  "LDM" = "#B43970","LF" = "#B43970","LM" = "#B43970","LS" = "#B43970","LW" = "#B43970","LWB" = "#B43970","RAM" = "#692F7C","RB" = "#692F7C","RCB" = "#692F7C",
  "RCM" = "#692F7C",
  "RDM" = "#692F7C","RF" = "#692F7C","RM" = "#692F7C","RS" = "#692F7C","RW" = "#692F7C","RWB" = "#692F7C","ST" = "#282A62")

p <- ggplot (data = new_data,
              mapping = aes(x = Finishing,
                             y = Value_numeric,color = Position,fill = Position))
p + geom_point (aes(color = Position,
                fill = Position),
                alpha = 0.7,size = 1.5) +
  geom_smooth(size = 0.7) +
  geom_text_repel(data = subset(new_data, Finishing > 90), mapping = aes(label = Name),color = "black") + 
  facet_wrap(~ Position) +
  scale_y_log10(labels = scales::label_number_si()) +
  scale_color_manual(values =custom_colors_p ) +
  theme_bw() +
  theme(legend.position = "none",
        strip.background.x = element_rect(fill = "#caadd8")) +
  labs(x = "Finishing scored", y = "Players' value(€)",
       title = expression(bold("Total Finishing & Players' value plot(faceted by Position)")), 
       subtitle = "Only players with contracts valid until 2020 onwards are displayed, and only players with an individual goal tally greater than 90 are marked ",
       caption = "Source:https://www.kaggle.com/datasets/mahmoudshogaa/fifa-data")

Here a scatterplot and a smooth curve are used to depict the number of goals scored(Finishing) by a player concerning their value, with different positions as facets to make it easier to compare the differences between different positions on the pitch. I have also labeled the players who have scored more than 90 goals, which gives the viewer information about the top performers.

Visualization 4 Body Types Impact on Players’value

####p 
data <- fifa_data %>% filter(`Contract Valid Until`>2020)  
p <- ggplot(data, aes(x=reorder(`Body Type`,Finishing,na.rm = TRUE), 
                      y=Finishing, fill=`Body Type`,color =`Body Type`)) +
  geom_boxplot(alpha=1,size = 0.7) +
  stat_summary(fun.y=mean, geom="point", shape=18, size=7, color="#6d8bc3", fill="#6d8bc3") +
  coord_flip() +
  scale_color_manual(values = c("Stocky" ="#caadd8","Lean" ="#af8fd0","Normal"="#efc0d2"),guide ="none") +
  scale_fill_manual(values = c("Stocky" ="#caadd8","Lean" ="#af8fd0","Normal"="#efc0d2"),
                    labels = c("Lean:785L 2284R", "Normal:1026L 3577R", "Stocky:115L 393R")) +
  facet_wrap(~ `Preferred Foot`) +
  theme_bw() +
  labs(x = "Body Type", y = "Total Finishing",
       title = expression(bold("Body Types Impact on Finishing(sorted by means)"))) +
  theme(legend.position="top",
        strip.background.x = element_rect(fill = "#c2acda"),
        panel.background = element_rect(fill = "#f0ecf7"),
        legend.key.size = unit(1, "cm")) 

###### value plot

convert_to_numeric <- function(input_vector) {
  cleaned_vector <- sub("€", "", input_vector)
  
  numeric_values <- ifelse(grepl("M$", cleaned_vector),
                           as.numeric(sub("M$", "", cleaned_vector)) * 1e6,
                           ifelse(grepl("K$", cleaned_vector),
                                  as.numeric(sub("K$", "", cleaned_vector)) * 1e3,
                                  as.numeric(cleaned_vector)))
  return(numeric_values)}


fifa_data$Value_numeric <- convert_to_numeric(fifa_data$Value)

data <- fifa_data %>% filter(`Contract Valid Until`>2020)  

value_plot <- ggplot(data, aes(x=reorder(`Body Type`,Value_numeric,na.rm = TRUE), 
                      y=Value_numeric, fill=`Body Type`,color =`Body Type`)) +
  geom_boxplot(alpha=1,size = 0.7) +
  stat_summary(fun.y=mean, geom="point", shape=18, size=7, color="#6d8bc3", fill="#6d8bc3") +
  coord_flip() +
  scale_color_manual(values = c("Stocky" ="#caadd8","Lean" ="#af8fd0","Normal"="#efc0d2"),guide = "none") +
  scale_fill_manual(values = c("Stocky" = "#caadd8", "Lean" = "#af8fd0", "Normal" = "#efc0d2"),
                    labels = c("Lean:785L 2284R", "Normal:1026L 3577R", "Stocky:115L 393R")) +
  facet_wrap(~ `Preferred Foot`) +
  scale_y_log10(labels = scales::label_number_si()) +
  theme_minimal() +
  labs(x = NULL, y = "Players' value(€)",
       title = expression(bold("Body Types Impact on Players'value(sorted by means)")), 
       caption = "Source:https://www.kaggle.com/datasets/mahmoudshogaa/fifa-data ") +
  theme(legend.position = "top",
        strip.background.x = element_rect(fill = "#c2acda"),
        panel.background = element_rect(fill = "#f0ecf7"),
        legend.key.size = unit(1, "cm")) 

library(Rmisc)
multiplot(p,value_plot,cols = 2)

In the fourth visualization, I used boxlpot to explore the effect of body type on player value and goals scored, and sorted the different body types according to the median. Several representative players are also compared as separate categories in the comparison. In addition, I use a legend to illustrate the number of preferred feet in the sample that are left and right-footed respectively.

For this data story, I have chosen the FIFA dataset on players and clubs to understand the basic physical and value data of soccer players as well as explore the factors that influence player performance and value. The dataset was last updated on December 8, 2023. This data story is designed to give soccer fans, analysts, and club management general insights into player diversity and trends.


In order to satisfy the visual literacy of different audiences: I prioritize visualizations that are clear and legible. Starting with histograms and bar charts for visualization 1, then gradually transitioning to more complex scatter plots and box plots. An overview of the value and performance distribution allows the viewer to visualize the nationality and club distribution at the beginning. This is followed by an exploration of the specific factors that influence player performance and value, allowing the viewer to gain insight into specific influences and trends. This sequence also ensures that the logical progression from general demographics to more specific athlete characteristics, which is consistent with the relationship between player performance and value. This design also balances exploration and explanation. To make it easy for less visually literate audiences to understand, I used color to improve clarity and contrast and added detailed legends to aid comprehension. Ultimately, I hope that different audiences can extract meaningful information from this data story.