courtOutline: Get the coordinates of lines on the court

Description Usage Arguments Value References Examples

Description

This function gets the coordinates of the lines on the court (sideline, baseline, three point line, etc.) for building custom shot charts. They are expressed in the same coordinates as those returned by the "shotchartdetail" endpoint.

Usage

1

Arguments

full,

flag indicating whether to return full court coordinates as opposed to half court coordinates. FALSE by default.

Value

A data frame containing coordinates of line segments that, when connected, draw the lines of an NBA court. The type column specifies which segment the point belongs to, and the ltype column specifies whether that line segment should be solid or dashed. The coordinates are in units of feet times 10 with the origin at the center of the hoop, the same as that returned by the "shotchartdetail" endpoint.

References

See http://www.sportsknowhow.com/basketball/dimensions/nba-basketball-court-dimensions.html for more information about how an NBA court is laid out.

Examples

1
2
3
4
5
6
7
## plot court using base graphics
court <- courtOutline()
plot(x = NULL, xlim = range(court$x), ylim = range(court$y), xaxt = "n", yaxt = "n", ann = FALSE)
for (nm in unique(court$type)) {
   s <- court$type == nm
   points(x = court$x[s], y = court$y[s], type = "l", lty = court$ltype[s])
}

llefebure/nba-stats documentation built on May 21, 2019, 7:34 a.m.