Skip to main content

API reference

Every public function, grouped by what it works with. Each page gives the signature, the arguments and what the function returns and raises.

Teams​

FunctionWhat it does
resolveCanonical team_id(s) for team values in one league.
suggestUp to n (team_id, name) candidates for a value that did not resolve, best first.
teamsThe bundled team index: one row per (league, team_id), with names, abbreviation, conference and colors.

Colors​

FunctionWhat it does
paletteA {team: "#hex"} dict for a league, ready for seaborn, Plotly, Altair, Bokeh or PyPalettes.
team_colorsOne "#hex" (or None) per team value, in the same container the values came in.

Logos and headshots​

FunctionWhat it does
logo_urlThe CDN URL of a team's logo or wordmark, chosen for the season.
logo_imageThe team's mark as a PIL image (downloaded once, then cached).
marksEvery archived mark for one team, best first.
headshot_urlA headshot URL for one player.

Plots and tables​

FunctionWhat it does
add_logosAdd team logos to a plot or table of any supported library.
add_wordmarksAdd team wordmarks to a plot or table of any supported library.
add_headshotsAdd player headshots to a plot or table of any supported library.
axis_logosReplace an axis' team labels with team logos on a plot of any supported library.
surfaceDraw the league's playing surface with sportypy, in a team's colors.
court_coordsConvert stats.nba.com / stats.wnba.com shot locations to the court frame sportypy draws.

Housekeeping​

FunctionWhat it does
versionsWhat a bug report needs: the package version, the bundled-index version, and the cached manifest's date.
clear_cacheDelete everything sdvplot has cached (manifest, images, rasters, nflverse).

Errors and warnings​

Errors and warnings: the warning sdvplot emits and the errors it raises, with what each means.