Skip to main content

Football pitch plotting library for matplotlib

Project description

mplsoccer logo

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


Installation

Use the package manager pip to install mplsoccer.

pip install mplsoccer

Or install via Anaconda.

conda install -c conda-forge mplsoccer

Docs

Read more in the docs and see some examples in our gallery.


Quick start

Plot a StatsBomb pitch

from mplsoccer import Pitch
import matplotlib.pyplot as plt
pitch = Pitch(pitch_color='grass', line_color='white', stripe=True)
fig, ax = pitch.draw()
plt.show()

mplsoccer pitch

Plot a Radar

from mplsoccer import Radar
import matplotlib.pyplot as plt
radar = Radar(params=['Agility', 'Speed', 'Strength'], min_range=[0, 0, 0], max_range=[10, 10, 10])
fig, ax = radar.setup_axis()
rings_inner = radar.draw_circles(ax=ax, facecolor='#ffb2b2', edgecolor='#fc5f5f')
values = [5, 3, 10]
radar_poly, rings, vertices = radar.draw_radar(values, ax=ax,
                                               kwargs_radar={'facecolor': '#00f2c1', 'alpha': 0.6}, 
                                               kwargs_rings={'facecolor': '#d80499', 'alpha': 0.6})
range_labels = radar.draw_range_labels(ax=ax)
param_labels = radar.draw_param_labels(ax=ax)
plt.show()

mplsoccer radar


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?

I would love the community to get involved in mplsoccer. Take a look at our open-issues for inspiration. Please get in touch at rowlinsonandy@gmail.com or @numberstorm on Twitter to find out more.


Recent changes

View the changelog for a full list of the recent changes to mplsoccer.


Inspiration

mplsoccer was inspired by:


License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mplsoccer-1.4.0.tar.gz (830.0 kB view details)

Uploaded Source

Built Distribution

mplsoccer-1.4.0-py3-none-any.whl (85.8 kB view details)

Uploaded Python 3

File details

Details for the file mplsoccer-1.4.0.tar.gz.

File metadata

  • Download URL: mplsoccer-1.4.0.tar.gz
  • Upload date:
  • Size: 830.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for mplsoccer-1.4.0.tar.gz
Algorithm Hash digest
SHA256 1c86bababc2922a35fc523431effd2f8158c98d8481a98fa4a1ad126f39e412c
MD5 26729f280f7bf32438b1aeb94a50ecbf
BLAKE2b-256 49460410d5d6308dbac970acb7fdf571930dbd3c6dd1f03bc6e409688e4aee4b

See more details on using hashes here.

File details

Details for the file mplsoccer-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: mplsoccer-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 85.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for mplsoccer-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19836575a9a16ba9624df3b4b71484bc56fe4133132a71aa8b0246971238bc1c
MD5 1e4292a53377b2a41b00d67323246a32
BLAKE2b-256 1f45fe2e10f4149c7c54a175cd5b73872ac3f0b96b77c1b59f1309f02576c045

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page