Skip to main content

surface

surface(
league: str,
team: Any = None,
*,
season: Any = None,
ax: Any = None,
center_logo: bool | float = False,
**sportypy_kwargs: Any,
) -> Any

Draw the league's playing surface with sportypy, in a team's colors.

Arguments​

NameTypeDescription
leaguestrThe SDV league key, e.g. "nfl", "nba", "nhl", "cfb", "soccer".
teamAnyA team to color the surface by (end zones, lane and apron, center line and boards); None for the plain surface.
seasonAnyThe season, for teams whose colors changed.
axAnyThe matplotlib Axes to draw on; None makes a new figure.
center_logobool | floatTrue to draw the team's logo at center ice / court / field (0.25 of the Axes height), or a height fraction.
**sportypy_kwargsAnyPassed to sportypy: display_range, xlim, ylim and rotation go to draw(); the rest (field_updates, color_updates, units, ...) to the surface class.

Returns​

matplotlib.axes.Axes — The Axes sportypy drew on.

Raises​

  • ValueError: If sportypy has no surface for league.
  • OptionalDependencyError: If the surfaces extra (sportypy) is not installed.

Example​

import sdvplot

ax = sdvplot.surface("nfl", "KC", center_logo=True)

See also​