Skip to content

27 open-source packages · R · Python · Node.js · 62.5M+ rows in the warehouse · 10 leagues in the warehouse · EPA · win probability · ratings models · free and open since 2021

sportypy for Python Sports Surfaces

Saiem Gilani

Saiem Gilani•June 11, 2026

1 min read•159 words

sportypy

sportypy is the Python counterpart to sportyR, also authored by Ross Drucker. It draws scaled, rule-book-accurate representations of sports playing surfaces with matplotlib, so your shot charts, tracking plots, and heatmaps sit on geometry that matches the real thing.

If you live in the PyData stack — pandas, matplotlib, seaborn — sportypy gives you the same surface fidelity that sportyR brings to ggplot2.

Installation

pip install sportypy

Quick start

Every surface is a class you instantiate and draw(). Pass an existing matplotlib Axes to layer your own data on top:

import matplotlib.pyplot as plt
from sportypy.surfaces.basketball import NBACourt
 
fig, ax = plt.subplots(figsize=(12, 6.5))
 
# Draw a regulation NBA court...
NBACourt().draw(ax=ax)
 
# ...then add your data
ax.scatter(shots["x"], shots["y"], c="#024F84", alpha=0.6)
plt.show()

Basketball, football, hockey, baseball, soccer, tennis, volleyball, and curling surfaces are all included, with league presets selectable per surface.

Learn more

Share this post: