Playing surfaces
Every court, field, rink, pitch and sheet sporty draws, as Observable Plot marks; a league's surface in a team's colours; and real events moved onto each surface with toSurfaceFrame.
Every sport
Pick a sport, then one of its rule sets (each league's dimensions are its own: an NBA three-point line is not a FIBA one). Show picks how much of the surface to draw (a half court, one zone, the whole thing), and Rotation turns it. A rotated surface is drawn upright, so a vertical court is narrower than a horizontal one.
In a team's colours
surface(league, { team }) from @sportsdataverse/sdvplot/plot paints a team's primary and secondary colours on the surface its league plays on (
Real events on each surface
Every data source has its own coordinates. toSurfaceFrame(rows, { from }) moves rows from a named frame into the surface's own (feet from the centre, for most surfaces), adding surface_x and surface_y. Pick a game; Marks draws each event as a dot in its team's colour, or a logo for each made shot, goal or touchdown.
- NBA: the fourth quarter of the Lakers at the Nuggets, 24 October 2023 (stats.nba.com
shotchartdetail, game 0022300061; Denver won 119-107), fromnba-legacy: tenths of a foot from the hoop. - NHL: the first period of game 7 of the 2024 Stanley Cup Final, Edmonton at Florida (NHL api-web play-by-play, game 2023030417; Florida won 2-1). NHL api-web already reports feet from centre ice, so no frame is needed.
- PWHL: the four goals of Boston at Montreal, 2 March 2024 (HockeyTech
gameCenterPlayByPlay, game 42; Montreal won 3-1), fromhockeytech: pixels on a 600 x 300 canvas. - NFL: the six offensive touchdowns of Super Bowl LIX, Kansas City at Philadelphia (ESPN
summary, event 401671889; Philadelphia won 40-22), fromespn-football-0-100: yards from the home team's goal line. ESPN gives no lateral position, so each play sits on the middle of the field.