Repository navigation
Releases: sportsdataverse/sdvplot
Releases · sportsdataverse/sdvplot
Release list
sdvplot 0.1.1
Added
sdvplot.pydeck(new[pydeck]extra): deck.gl layer props for pydeck, the same as sdvplot-js's./deckglbuilds
(held to one shared fixture).logo_icon_layerdraws team logos at points (anIconLayerof auto-packed logo
icons),pass_arc_layerdraws arcs in team colors (primary at the source, secondary at the target; with
background, 3:1 contrast and ΔE 20 apart through sdvplot-js's team palette, ported), andsurface_layerdraws a
sportypy rink, pitch, court or field as aPolygonLayerin the surface's own coordinates. The props are plain dicts
(pydeck.Layer(**props));deck()builds apydeck.Deckfitted to a surface or a map.sdvplot.perspective(new[perspective]extra, Python 3.11+):perspective_sdv_config(frame, team_col=, league=, plugin=, theme=, mode=)returns a Perspective viewer config (PerspectiveWidget(data, **config)or the JavaScript
restore()) that colors each team with the shared team palette: the Datagrid fills the team column's cells, and a
chart splits by team and colors each team's series. A registry table theme sets the grid's fonts and sign colors.
Number columns get formats (3 decimals, 1 for a percentage, integers plain;formats=overrides).
perspective_logo_column(frame, team_col, league=)adds each team's logo URL, shown as a link.sdvplot.itables.itables_sdv_theme(name, mode=, table_id=)returnsclasses,styleand a scopedcssstring
(with a Google Fonts import) that styles anitables.showtable like any of the 122 surveyed themes.sdvplot.plottable.plottable_sdv_theme(name, mode=)returns theplottable.Tablekeywords (text, dividers, stripes) for
any of the 122 surveyed themes, plus afacecolorto pop and apply to the figure; a font matplotlib cannot find falls
back to its generic family with one warning per family.table_theme_spec()andsdv_table_themes(): resolve and list the 122 surveyed table themes (light and dark).sdvplot.great_tables.gt_theme_source(gt, name, mode=, density=)styles a table like any of the 122 surveyed
themes, plus 20 named shortcuts (gt_theme_datagolf,gt_theme_economist,gt_theme_basketball_reference, ...)
generated bytools/gen_gt_shortcuts.py.reactable_sdv_theme(name, mode=)accepts every registry theme, and the newreactable_sdv_args(name, mode=)returns
theReactablekeywords (theme,striped,highlight,bordered,compact) that match it. reactablefmtr names
are unchanged;mode="dark"on a reactablefmtr theme raises unless the theme is dark already.teams(league, include_conferences=True)lists sdvplotR's conference and league rows (itsinclude_conferences):
the 89 college conferences of cfb, mbb and wbb and the AFC, NFC and NFL, withprogram"conference"or"league",
the conference's short name asteam_idandabbr, cbbplotR's colors (color_source"cbbplotR") and the
conference_idthe league's teams carry. The default lists teams only, andresolve()andpalette()never
answer a conference key, so no existing call changes.- Conference and league logos from the archive (sdvplotR's
logo_marksfor those rows):logo_url("SEC", "cfb"),
logo_url("AFC", "nfl"),logo_url("NFL", "nfl")and every mark helper (marks,logo_image,add_logos,
axis_logos,geom_sdv_logos, the table marks, the web adapters) take a conference or league row's key, with
variant="dark"where the archive has one (16 CFB conferences, the AFC, NFC and NFL) and the usual fallbacks. The
key is read after every team alias, so CFB'sMACis still Macalester, andresolve()still answers no conference:
the rows' only aliases are "mark" aliases, which name the manifest's own conference rows
(level:league:source:entity_id;tools/build_index.pyconference_mark_aliases, from the new
data-raw/manifest_conferences.csvsnapshot). All 92 rows have a primary mark, as sdvplotR's 92 do. - Headshots by the league's own player id:
id_system="league"(sdvplotR'sid_type = "league") onheadshot_url
and every headshot helper (add_headshotson every adapter,geom_sdv_headshots,gt_sdv_headshots,
gt_sdv_cols_label(mark_type="headshot"),reactable_sdv_headshots,plottable.headshot_column) draws an NBA or
WNBA StatsPERSON_ID(what nba_api, hoopR and wehoop return), an MLBAM id or an NHL API id from the league's CDN,
with sdvplotR's URL templates; for the NFL it is the gsis id."espn"stays the default. A league without them is
anInputErrornaming the ones that have them, and aDownloadErrorfrom cdn.nba.com or cdn.wnba.com with a 403
says that those CDNs block datacenter and cloud IPs. surface("fiba")draws a FIBA court (no team yet).sdvplot.plotnine.scale_color_sdvandscale_fill_sdvtakealpha=, an opacity applied to the team colors
(sdvplotR'salpha);na_valueis drawn as given.scale_colour_sdvis the British alias sdvplotR and plotnine
both ship.gt_merge_stack_team_colortakesbackground=, the cell background the bottom line's color is checked against;
the default reads the table's background, so a theme applied first is taken into account.gt_tierstakesalt=, a function from the image paths or URLs to their alt text. By default a logo the archive
knows (anylogo_url) is named by its team and any other image by its file name; the images had no alt text at
all. The alt comes from the cell's value, so a local file (embedded as a data URI) gets a real name.pitch_coords()converts soccer event coordinates from Opta / Stats Perform, Wyscout, StatsBomb, UEFA, Impect,
ESPN and the tracking providers (Tracab, SkillCorner, Second Spectrum, Metrica) to one regulation 105 x 68 m
frame, piecewise-linearly between pitch landmarks, withflipfor teams attacking opposite ends. The port of
sdvplotR'ssdv_pitch_coords(), matched to 1e-12 on every provider.court_coords(provider="euroleague")converts the Euroleague shot frame of sportsdataverse-py's
euroleague_game_points()(coord_x/coord_y: integer centimeters, hoop at the origin, both teams on one basket,
free throws as-1,-1) onto the FIBA courtsurface("fiba")draws, in meters, with the-1,-1free throws as
null. The default"nba"is unchanged, byte for byte. Matched to sdvplotR'ssdv_court_coords(provider = "euroleague")bit for bit on a real Euroleague game (tests/fixtures/euroleague_points_E2025_1.csv).tools/espn_soccer_y_gate.py, the measurement behind the ESPN frame's y direction.axis_logos(..., mark_type="headshot")draws player headshots as axis labels on matplotlib, plotnine, Plotly and
Altair (the port of sdvplotR'sscale_x_sdv_headshots()/scale_y_sdv_headshots()andelement_sdv_headshot()):
the tick labels are read as player ids (id_system"espn", which"auto"means,"gsis"or"league"), each headshot
keeps its own aspect, an unknown id stays as text with one warning, and the adapters without axis logos raise
UnsupportedTargetErroras before.sdvplot.typing.AxisMarkTypeis theLiteralof the three mark types. The
matplotlib y-axis label pad now grows by the widest image's width, so wordmarks and headshots no longer overlap
their tick labels' room. The adapter contract (check_adapter_contract, rule 7) checks the headshot axis too.
Changed
- The README links the JavaScript / TypeScript port, sdvplot-js, now on npm: an npm badge and an Installation note
for@sportsdataverse/sdvplot,@sportsdataverse/sportyand@sportsdataverse/sdvtables, with their docs at
plot.sportsdataverse.org. - The docs site's SDV menu adds cfbseedR and sdvplot-js, and the README's SportsDataverse table adds sdvplot-js, so
the package lists match the other SportsDataverse sites. - polars 2.x is supported: the dependency is
polars>=1.24(was<2). With every optional extra installed,
the full suite (2,343 tests) passes on polars 2.0.0, the same as on 1.44. - numpy is now a core dependency (it was optional, needed only by
pitch_coords()). surface("soccer")draws a regulation 105 x 68 m pitch by default (it drew sportypy's 120 x 90 m maximum), the
framepitch_coords()returns;pitch_updatesstill overrides it key by key.gt_merge_stack_team_colorkeeps the bottom line readable (sdvplotR #55): the team's primary color when it clears
4.5:1 contrast (WCAG AA) on the cell background, else the secondary, else the primary darkened (or lightened, on a
dark table) until it does, so Missouri's gold (1.8:1 on white) reads on a white table and stays gold on a dark one.
An unknown team's grey goes through the same rule.gt_spotlight(dim_color=)defaults to"auto"(sdvplotR #61): the other rows are dimmed to the table's text
blended toward its background until it clears 4.5:1 (#737373on white), instead of the fixed#BBBBBB, which is
1.9:1 on white and barely dimmer than the text on a dark theme. Pass a color to choose it, orNonenot to dim.team_tiers(matplotlib and plotnine) takesvariant=, default"auto": the dark theme now draws the archive's
dark-background logos (the"dark"variant), so dark marks such as the Capitals', the Giants', Penn State's or
Iowa's no longer fade into the near-black background. A team with no dark mark draws its default one, with no
warning; the light theme still draws the default logos. Passvariant="default"for the old look (sdvplotR's), or
any variantadd_logostakes.- great_tables 1.1 is supported. Its
data_colornow interpolates in CIELAB, as R gt andscales::col_numericdo,
sogt_color_ranksfills match sdvplotR's exactly under it;gt_color_pills,gt_percentile_barand the
gt_legend_continuoussteps now draw great_tables' own gradient, so they stay equal todata_colorcells on every
version (CIELAB from 1.1, sRGB before) and match sdvplotR's colors from 1.1 (they were sRGB approx...
sdvplot 0.1.0
First release of sdvplot, the SportsDataverse package of team logos, wordmarks, headshots and colors for plots and tables in Python (the counterpart to sdvplotR).
pip install sdvplot # core
pip install "sdvplot[mpl]" # with matplotlib- Team identity for 28 leagues: resolve abbreviations, ESPN/league ids and historical codes by season, with team colors, logos and wordmarks from a dated logo archive.
- Adapters for matplotlib, seaborn, plotnine, plotly, altair, bokeh, holoviews, folium and pygal, plus great_tables, reactable and plottable table helpers and
surface()rinks, courts and fields. - A frozen public API: keyword-only options,
sdvplot.SdvplotErrorsubclasses for every failure, and an offline-friendly disk cache.
Docs, tutorials, cookbooks and the gallery: https://sdvplot.sportsdataverse.org
Full notes, including migrating from the git pre-release: CHANGELOG