UCL Final June 2023: Manchester City vs Inter Milan — Season Comparison

Ebo Jackson
Level Up Coding
Published in
6 min readJun 10, 2023

--

Introduction:

The UEFA Champions League final is a highly anticipated football match that showcases the best teams from across Europe. In the final of June 2023, Manchester City and Inter Milan are set to battle for the prestigious trophy. This article aims to analyze the performance of both teams based on key statistical metrics using a radar plot generated with Plotly. By examining various aspects such as expected goals, goal difference, and table points, we can gain insights into which team might have the upper hand in the final showdown.

Analyzing the Radar Plot:

The radar plot provides a visual representation of the performance metrics for both Manchester City and Inter Milan. Let’s examine the different attributes and their implications for each team.

1. Expected Goals (xGoals):
Expected goals measure the quality of scoring chances a team creates during a match. Manchester City has a higher xGoals value of 77.7 compared to Inter Milan’s 68.0. This suggests that Manchester City has been more effective in generating scoring opportunities.

2. Expected Goals Against (xGoals Against):
The xGoals Against metric reflects the quality of scoring chances the opposing teams create against a team’s defense. Manchester City has a lower xGoals Against value of 31.3, indicating a strong defensive performance. Inter Milan has a slightly higher xGoals Against value of 36.5.

3. Expected Goals Difference (xGoals Difference):
The xGoals Difference represents the balance between a team’s attacking and defensive performance. Manchester City holds a higher xGoals Difference value of 46.4, highlighting their dominant attacking prowess compared to Inter Milan’s 31.6.

4. Goals For:
Goals For signifies the number of goals a team has scored during the season. Manchester City has scored 94 goals, displaying their ability to find the back of the net consistently. Inter Milan has scored 71 goals, indicating a slightly lower scoring rate.

5. Goals Against:
Goals Against indicates the number of goals conceded by a team’s defense. Manchester City has a lower Goals Against value of 33, reflecting their strong defensive record. Inter Milan has conceded 42 goals, suggesting a relatively weaker defense.

6. Goal Difference:
Goal Difference represents the numeric difference between goals scored and goals conceded. Manchester City boasts a higher Goal Difference value of 61, indicating their overall superior performance compared to Inter Milan’s 29.

7. Table Points:
Table Points reflect the accumulation of points throughout the season, indicating a team’s position in the league. Manchester City has secured 89 points, highlighting their consistent success. Inter Milan has accumulated 72 points, representing a respectable performance but falling slightly behind Manchester City.

Python Code for the Radar Plot:

import plotly.express as px
import plotly.graph_objects as go
import pandas as pd

# Define the data
data = {
'Squad': ['Manchester City', 'Inter Millan'],
'xGoals': [77.7, 68.0],
'xGoals Against': [31.3, 36.5],
'xGoals Difference': [46.4, 31.6],
'Goals For': [94, 71],
'Goals Against': [33, 42],
'Goal Difference': [61, 29],
'Table Points': [89, 72]
}

# Create a list of attributes to include in the radar plot
attributes = ['xGoals', 'xGoals Against', 'xGoals Difference', 'Goals For', 'Goals Against', 'Goal Difference', 'Table Points']

# Create a list of values for each squad
values = []
for squad_data in zip(*[data[attr] for attr in attributes]):
values.append(list(squad_data))

# Create a trace for each squad
traces = []
for squad, squad_values in zip(data['Squad'], values):
trace = go.Scatterpolar(
r=squad_values,
theta=attributes,
fill='toself',
name=squad
)
traces.append(trace)

# Create the layout for the radar plot
layout = go.Layout(
height=1000,
title="UCL FINAL JUNE 2023. MAN CITY VS INTER MILLAN. SEASON COMPARISON",
polar=dict(
radialaxis=dict(
visible=True,
range=[0, max(max(data[attr]) for attr in attributes)]
)
),
showlegend=True
)

# Create the figure and plot the radar plot
fig = go.Figure(data=traces, layout=layout)
fig.show()

Technical Explanation of the Python Code:

This code is used to create a radar plot using Plotly, comparing the performance of two football teams, Manchester City and Inter Milan, in the context of the UEFA Champions League (UCL) final in June 2023. Let’s break down the code and explain it step by step:

1. Importing the necessary libraries:
— `plotly.express` is imported as `px`, which provides a simplified interface for creating interactive plots.
— `plotly.graph_objects` is imported as `go`, which allows creating more customized and detailed plots.
— `pandas` is imported as `pd`, which provides data manipulation and analysis capabilities.

2. Defining the data:
— The `data` variable is a dictionary that contains the performance metrics for the two teams.
— Each key in the dictionary represents a specific metric, such as ‘Squad’, ‘xGoals’, ‘xGoals Against’, etc.
— The corresponding values for each metric are provided as lists.

3. Creating a list of attributes:
— The `attributes` variable is a list that includes the attributes (performance metrics) to be displayed on the radar plot.
— These attributes are selected from the keys in the `data` dictionary.

4. Creating a list of values for each squad:
— The `values` list is created to hold the values of each attribute for each squad.
— Using a loop and the `zip` function, the values are extracted from the `data` dictionary based on the attributes.
— The `values` list is populated with lists containing the values for each squad, aligned with the corresponding attributes.

5. Creating a trace for each squad:
— The `traces` list is created to hold the traces (data points) for each squad in the radar plot.
— Another loop is used to iterate over the squads and their respective values.
— For each squad, a trace is created using `go.Scatterpolar`, specifying the values (`r`), attributes (`theta`), and squad name (`name`).
— The `fill` parameter is set to ‘toself’, which fills the area enclosed by the data points.
— Each trace is appended to the `traces` list.

6. Creating the layout for the radar plot:
— The `layout` variable is defined to specify the visual layout settings for the radar plot.
— The `height` parameter sets the height of the plot to 1000 pixels.
— The `title` parameter sets the title of the plot.
— The `polar` parameter is used to configure the polar coordinates for the radar plot.
— The `radialaxis` parameter is configured to be visible and set the range based on the maximum value among all attributes.
— The `showlegend` parameter is set to True, which displays the legend in the plot.

7. Creating the figure and plotting the radar plot:
— The `go.Figure` function is used to create a figure object, which will hold the traces and layout.
— The `data` parameter is set to the `traces` list, containing the data points.
— The `layout` parameter is set to the `layout` variable, specifying the visual settings.
— Finally, the `fig.show()` method is called to display the radar plot.

The radar plot provides a visual comparison of the performance metrics for Manchester City and Inter Milan in the UCL final, showcasing their strengths and weaknesses in various aspects of the game.

Conclusion:

Based on the analysis of the radar plot and the statistical metrics, Manchester City appears to have an advantage over Inter Milan in several key areas. They have demonstrated superior attacking efficiency, a solid defensive record, and a higher goal difference. Additionally, their accumulation of more table points throughout the season showcases their overall consistency and performance.

However, it is important to note that football matches can be unpredictable, and the final result depends on various factors such as team form, individual performances, and tactical decisions. While the radar plot provides valuable insights, the outcome of the UCL final between Manchester City and Inter Milan will ultimately be determined on the field.

As football fans, we eagerly anticipate the clash between these two talented teams and the excitement that the UCL final brings.

--

--