Football Visualization Fundamentals

Jorge Mendoza Rivilla
4 min readJun 4, 2023


Data help make better decisions, and something useful for this statement is data visualization.

Visualization helps to summarize the amount of data generated, actually, the task visualization is frequently in exploratory data analysis (EDA), descriptive analysis, or business intelligence.

See figure 1, it’s a data set with pass event data Alex Morgan: Is it easy to identify patterns or trends?

However, figure 2, with descriptive data visualization, clearly identifies actions.

Figure 1 — Data with event data of pass
Figure 2 — summarize by pass height.

In match reports or live analysis , visualization it’s useful to give quick and clear explanations of whats going on.

In football, the message needs to be even more direct. In the dressing room at half-time, with the team behind by two goals and unable to keep control of the ball, the manager has to be able to convey a plan quickly. I try to imagine what I would do in that situation. The manager is lost for ideas, and in a final act of desperation he turns to me, the mathematician, and asks, ‘Can you see the problem?’ — Sumpter, David. Soccermatics (Bloomsbury Sigma) (p. 120)

One of the best ways for a mathematician to communicate results is through pictures. Figure 3 reveals some of the most important features of the Euro 2012 quarter-final between England and Italy. It shows the passing networks for both teams over the 120 minutes played, including extra time. Each point represents a player. A link between pairs of players indicates that they made 13 or more successful passes to each other during the match. Thicker lines indicate a higher number of passes. [ Sumpter, David. Soccermatics ]

Figure 3 — Passing networks Italy.
Sumpter, David. Soccermatics

Most frequent visualitations on event data

  • Shot and pass maps
  • Passing networks
  • Heat maps
  • Key Performance Indices (KPI)
  • Expected Goals
  • Entries in to the final third
Shot map
Passing map
Passing networks

Python libraries for visualization

Similar to data analysis for companies, the matplotlib is useful to event data visualization.

The matplotlib is necessary for the plot pitch and your information and is commonly used with mplsoccer.

The mplsoccer is a Python library for plotting soccer/football charts in Matplotlib and loading StatsBomb open-data.

Also with mplsoccer you can plot:

  • plot football/soccer pitches on nine different pitch types
  • plot radar charts
  • plot Nightingale/pizza charts
  • plot bumpy charts for showing changes over time
#Your friends :)

import matplotlib.pyplot as plt
from mplsoccer import Pitch, Sbopen, VerticalPitch

Others commonly used libraries are seaborn, soccerplots and matplotsoccer.

Practice: Plotting shots

Well, now you can plot the shot about favorite teams. The practice its realized with free Statsbomb data.

parser = Sbopen()
#The 69321 is the wwc final match : United States vs Netherlands.
df, related, freeze, tactics = parser.event(69321)
#get team names
team1, team2 = df.team_name.unique()
#A dataframe of shots
shots = df.loc[df['type_name'] == 'Shot'].set_index('id')

An example of a shot is the goal, Rapinoe and Lavelle have scored in the final and we see this event it see at the figure 4.

pitch = Pitch(line_color = "black")
fig, ax = pitch.draw(figsize=(10, 7))
#Size of the pitch in yards (!!!)
pitchLengthX = 120
pitchWidthY = 80
#Plot the shots by looping through them.
for i,shot in shots.iterrows():
#get the information
#set circlesize
#plot England
if (team_name==team1):
if goal:
#plot Sweden
if goal:
shotCircle=plt.Circle((pitchLengthX-x,pitchWidthY - y),circleSize,color="orange")
plt.text(pitchLengthX-x+1,pitchWidthY - y - 2 ,shot['player_name'])
shotCircle=plt.Circle((pitchLengthX-x,pitchWidthY - y),circleSize,color="orange")
#set title
fig.suptitle("United States Women's (blue) and Netherlands Women's (orange) shots", fontsize = 24)
fig.set_size_inches(10, 7)
Figure 4 — United States Women’s (blue) and Netherlands Women’s (orange) shots

I share the notebook that includes another shooting event.



Jorge Mendoza Rivilla

Data Analytics | Management | Football Analytical | AI | I Write to Understand