API reference
Every public function, grouped by what it works with. Each top-level function has a page, and each public submodule (the library adapters, the table helpers, sdvplot.testing and sdvplot.typing) has one page with a section per name. Each gives the signature, the arguments and what the function returns and raises.
Teams
| Function | What it does |
|---|---|
| resolve | Canonical team_id(s) for team values in one league. |
| suggest | Up to n (team_id, name) candidates for a value that did not resolve, best first. |
| teams | The bundled team index: one row per (league, team_id), with names, abbreviation, conference and colors. |
Colors
| Function | What it does |
|---|---|
| palette | A {team: "#hex"} dict for a league, ready for seaborn, Plotly, Altair, Bokeh or PyPalettes. |
| team_colors | One "#hex" (or None) per team value, in the same container the values came in. |
Logos and headshots
| Function | What it does |
|---|---|
| logo_url | The CDN URL of a team's logo or wordmark, chosen for the season. |
| logo_image | The team's mark as a PIL image (downloaded once, then cached). |
| marks | Every archived mark for one team, best first. |
| headshot_url | A headshot URL for one player. |
Plots and tables
| Function | What it does |
|---|---|
| add_logos | Add team logos to a plot or table of any supported library. |
| add_wordmarks | Add team wordmarks to a plot or table of any supported library. |
| add_headshots | Add player headshots to a plot or table of any supported library. |
| axis_logos | Replace an axis' team labels with team logos (or a player axis' with headshots) on any supported library. |
| surface | Draw the league's playing surface with sportypy, in a team's colors. |
| court_coords | Convert stats.nba.com / stats.wnba.com (or Euroleague) shot locations to the court frame sportypy draws. |
| pitch_coords | Convert soccer event coordinates from any provider's frame to the pitch surface("soccer") draws. |
| Submodule | What it holds |
|---|---|
| sdvplot.matplotlib | The matplotlib adapter: logos, wordmarks and headshots on Axes, single-Axes Figures and seaborn grids. |
| sdvplot.plotnine | The plotnine adapter: logo, wordmark, headshot and image geoms, axis logos, team color scales and reference lines. |
| sdvplot.plotly | The Plotly adapter: logos, wordmarks, headshots and axis logos as layout images on a Plotly Figure. |
| sdvplot.altair | The Altair adapter: logos, wordmarks and headshots as a native Vega-Lite image layer. |
| sdvplot.bokeh | The Bokeh adapter: logos, wordmarks and headshots as one image_url glyph per call on a Bokeh figure. |
| sdvplot.holoviews | The HoloViews adapter: a Bokeh plot hook that draws the marks through the Bokeh adapter when the element renders. |
| sdvplot.folium | The Folium adapter: logos, wordmarks and headshots as map markers with image icons. |
| sdvplot.pygal | The pygal adapter: logos, wordmarks and headshots on pygal XY charts, plus team colors as a pygal Style. |
| sdvplot.pydeck | The pydeck adapter: team logos, team-colored arcs and sportypy playing surfaces as pydeck layer props. |
| sdvplot.great_tables | great_tables helpers (pip install sdvplot[tables]), ported from sdvplotR's gt_* functions. |
| sdvplot.reactable | reactable-py columns (pip install sdvplot[reactable]), ported from sdvplotR's reactable_sdv_* functions, plus reactablefmtr's cell formatters (data bars, color tiles and scales, pills, icons, merged columns, highlights, bubbles). |
| sdvplot.plottable | plottable columns of team logos, wordmarks and player headshots. |
| sdvplot.itables | itables styling (pip install sdvplot[itables]): a surveyed table theme as DataTables CSS and show options. |
| sdvplot.perspective | Perspective (pip install sdvplot[perspective], Python 3.11+): team colors, registry fonts and a logo column for a Perspective viewer. |
Table themes
| Function | What it does |
|---|---|
| table_theme_spec | Resolve a surveyed table theme (e.g. datagolf, wikipedia, nejm) by its source name. |
| sdv_table_themes | List the surveyed table themes, optionally only those usable in a mode or in one category. |
Housekeeping
| Function | What it does |
|---|---|
| versions | What a bug report needs: the package version, the bundled-index version, and the cached manifest's date. |
| clear_cache | Delete everything sdvplot has cached (manifest, images, rasters, nflverse, URL images such as headshots). |
| Submodule | What it holds |
|---|---|
| sdvplot.testing | Shared behaviour every adapter must have. Adapter test suites call check_adapter_contract(). |
| sdvplot.typing | Types for annotating code that calls sdvplot: the Literal aliases of its closed argument vocabularies. |
Errors and warnings
Errors and warnings: the warning sdvplot emits and the errors it raises, with what each means.