Skip to content

Instantly share code, notes, and snippets.

View rajshah4's full-sized avatar

Rajiv Shah rajshah4

View GitHub Profile
@rajshah4
rajshah4 / ggplot.nba.halfcourt
Last active January 10, 2016 16:56
This code, forked from Ed Küpfer, creates a shot chart. Building from the work of Asteves, this code rotates the court 90 degrees.
#Forked from Ed Küpfer and Asteves
#https://gist.github.com/edkupfer
#https://gist.github.com/asteves/7266330
#Updated to rotate half court 90 degrees
#Generate Data for the 3 point line
# Define the circle; add a point at the center if the 'pie slice' if the shape is to be filled
circleFun <- function(center=c(0,5.25), diameter=20.9, npoints=20000, start=0, end=1, filled=TRUE){
tt <- seq(start*pi, end*pi, length.out=npoints)