Installation ( mplsoccer)
To install the latest version via pip
⌘ pip install mplsoccer
To upgrade to the latest version from a previous version via pip
⌘ pip install -U mplsoccer
You may also need to upgrade mplsoccer dependencies such as seaborn.
1. Grass pitches

⌘
from mplsoccer import Pitch
import matplotlib.pyplot as plt
pitch = Pitch(pitch_color=’grass’, line_color=’white’, stripe=True)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
plt.show()
2. Choose your favorite colors

⌘
pitch = Pitch()
pitch = Pitch(pitch_color=’Black’, line_color=’white’)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
3. e.g. useful if you want to plot pitch lines over heatmaps

⌘
# e.g. useful if you want to plot pitch lines over heatmaps
pitch = Pitch(line_zorder=2)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
4. example plotting an Opta/ Stats Perform pitch

⌘
# example plotting an Opta/ Stats Perform pitch
pitch = Pitch(pitch_type=’opta’)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
5. Example plotting a tracab pitch

⌘
# example plotting a tracab pitch
pitch = Pitch(pitch_type=’tracab’,
pitch_length=102, pitch_width=68,
axis=True, label=True) # showing axis labels is optional
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
6. Axis

⌘
pitch = Pitch(axis=True, label=True, tick=True)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
7. Juego de Posición

⌘
#Juego de Posición
pitch = Pitch(positional=True, shade_middle=True, positional_color=’#eadddd’, shade_color=’#f2f2f2′)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(10, 5))
8. Vertical full

⌘
#Vertical full
pitch = VerticalPitch(half=False)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(12, 8))
9. Horizontal half

⌘
#Horizontal half
pitch = Pitch(half=True)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(12, 8))
10. Vertical half

⌘
#Vertical half
pitch = VerticalPitch(half=True)
# specifying figure size (width, height)
fig, ax = pitch.draw(figsize=(12, 8))
Downloadable files:
Download the high-res PDF 👇
Here
Download Ipynp File 👇
Here
Appreciate the recommendation. Let me try
it out.