sportypy
sportypy draws regulation, to-scale playing surfaces with matplotlib, so
tracking and play-by-play data can be plotted on the field, court, rink or
sheet it came from. It covers baseball, basketball, curling, football, hockey,
lacrosse, soccer, softball, tennis and volleyball, with a class for each
league's rule-book dimensions.
It is the Python counterpart of sportyR
and keeps parity with it: the same leagues, dimensions, colors and display
ranges. For JavaScript and TypeScript, @sportsdataverse/sporty
is the port of both.
Installation
sportypy supports Python 3.10 and newer.
pip install sportypy
or, in a uv project,
uv add sportypy
Draw a surface
import matplotlib.pyplot as plt
from sportypy.surfaces.hockey import NHLRink
NHLRink().draw()
plt.show()
Where to next
- Getting started: display ranges, units, rotation, colors, and plotting data on a surface.
- API reference: every sport's base class, its league classes and their methods, generated from the docstrings.
- Plotting and display: the plotting helpers
(
scatter,heatmap,contour,hexbin,arrow, ...) every surface has. - News: what changed in each release.