mplsoccer is a Python library for plotting soccer/football charts in Matplotlib and loading StatsBomb open-data.
Use the package manager pip to install mplsoccer.
pip install mplsoccer
Plot a StatsBomb pitch:
from mplsoccer.pitch import Pitch pitch = Pitch(pitch_color='grass', line_color='white', stripe=True) fig, ax = pitch.draw()
What is mplsoccer?
In mplsoccer, you can:
plot football/soccer pitches on nine different pitch types
plot radar charts
plot Nightingale/pizza charts
plot bumpy charts for showing changes over time
plot arrows, heatmaps, hexbins, scatter, and (comet) lines
load StatsBomb data as a tidy dataframe
standardize pitch coordinates into a single format
I hope mplsoccer helps you make insightful graphics faster, so you don’t have to build charts from scratch.
Want to help?
View the changelog for a full list of the recent changes to mplsoccer.
mplsoccer was inspired by:
Peter McKeever heavily inspired the API design
ggsoccer influenced the design and Standardizer
lastrow’s legendary animations
fcrstats’ tutorials for using football data
fcpython’s Python tutorials for using football data
Karun Singh’s expected threat (xT) visualizations
StatsBomb’s great visual design and free open-data
John Burn-Murdoch’s tweet got me interested in football analytics