ptplot
makes it easy to turn player-tracking data into beautiful,
interactive visualizations — including animations! These visualizations can be used to guide
data exploration/analysis work, or to embed in webpages to share with
the world.
ptplot
can be installed via pip:
$ pip install ptplot
It is strongly recommended that you install ptplot
into a virtual
environment, such as with conda
:
[After installing conda]
$ conda create -n player_tracking python=3
$ conda activate player_tracking
$ pip install ptplot
You may wish to install some of ptplot
's dependencies
via conda, specifically pandas
and bokeh
:
[After installing conda]
$ conda create -n player_tracking python=3 pandas bokeh
$ conda activate player_tracking
$ pip install ptplot
Making your first plot can be as simple as
import pandas as pd
from bokeh.plotting import show
from ptplot import PTPlot
from ptplot.nfl import Field
from ptplot.plot import Positions
data = pd.read_csv("YOUR PLAYER TRACKING DATA")
plot = PTPlot(data) + Field() + Positions("X_COORDINATE_COLUMN", "Y_COORDINATE_COLUMN")
show(plot.draw())
For additional documentation and examples, check out the
notebooks in the notebooks/
directory, which can be viewed
online with all of the plots correctly rendered via nbviewer:
Additionally, layers within ptplot
have docstrings with
more usage details. Those can be accessed either by reading the
source code or running help([FUNCTION])
inside of Python.
See here