
Interactive NBA Shot Charts with R and Shiny - lil_tee
http://toddwschneider.com/posts/ballr-interactive-nba-shot-charts-with-r-and-shiny/
======
kohanz
Nice work. I expect the OP will be hearing from NBA teams at some point. There
was a guy who made something very similar a couple of years ago (not in R, but
same functionality) and he now works for an NBA team (a friend of mine works
on the same analytics team). Of course, he had to bring his side-project with
him and take it offline.

~~~
ssharp
Kirk Goldsberry? He did these for Grantland and now works with the Spurs.

~~~
kohanz
No, Goldsberry was very high profile (did a lot of work for ESPN/Grantland).
I'm talking about more of a hacker type who did a Show HN type side-project
and got noticed entirely through that.

edit: I found the project - looks like it back online:
[http://peterbeshai.com/buckets/app/#/playerView/201935_2015](http://peterbeshai.com/buckets/app/#/playerView/201935_2015)

------
baldfat
This is why I love R. This works great and the code is super clean.

NBA Notes: I love the fact that the players are sorted by first name and that
made no difference. This is the easiest to follow professional sport in the
world.

Carmelo Anthony: He started shooting from the right 3pt corner really well.
Now 10 years later he is hot from the left corner and not that right polar
opposite. Seems like the sides he shot from changed in a pattern. I bet you
the scouts were like Anthony can't shoot from the right make him shoot from
there and he would practice that side.

------
fluxquanta
With the way Curry has been playing some of these charts are going to need to
be re-scaled to include beyond the half court line. 35/57 from 28 feet and
farther currently (61.4%).

~~~
defen
To put into perspective how absurd that is...to a first approximation
(ignoring rebounds, open opportunities, etc) - Curry's expected value for
shooting from 6 or more feet _behind_ the three point line (1.923) is _higher_
than almost any other shot any other player in NBA history could attempt,
except perhaps an uncontested dunk. You'd rather Curry attempt one of his
super-deep threes than have the best free-throw shooter of all time (Steve
Nash) take two free throws (90.43% accuracy, expected value 1.8086 points).

That is just insane.

~~~
e40
When you put it like that it gives me goosebumps. It is truly a great time to
be an NBA fan.

~~~
baldfat
It is a great time BUT I miss the drama of the 1980s and early 1990s. At least
I don't get the normal "I watch college basketball" when I start talking
basketball. I am an avid UConn fan and they don't know college either except
the Final 4 tourney polls they are apart of.

------
minimaxir
I've had looked into Shiny apps for my own ggplot2 work, but after seeing the
usage in this post, I'll definitely give it another look!

What initially kept me away was the amount of idiosyncratic code required for
the server/UI without many tutorials, which made compatibility annoying.
Looking at the code in the GitHub, the code still seems pretty difficult.
That, and [http://www.shinyapps.io/](http://www.shinyapps.io/) (which the OP
is using) is very ambigious in their pricing on how "Active Hours" work, which
is a valid concern when a post hits the front page of Hacker News.

~~~
RA_Fisher
It's possible to host a Shiny app yourself. This one runs on AWS EC2 inside a
docker container: [http://www.statwonk.com/birthday-
problem/](http://www.statwonk.com/birthday-problem/)

~~~
minimaxir
That appears to be the best option for my use cases. Although I'm not sure if
that makes pricing worse or better. :P

~~~
aroch
I host two different RNAseq and NGS data exploration shiny apps on a 2GB DO
droplet and it works pretty well. Shiny-server is sort of a pain in the ass
though, and I agree the documentation sucks

------
fuzzythinker
Similar but not as featured and fancy with vega:

[http://sandbox.github.io/demos/nba-shot-chart-
vega/](http://sandbox.github.io/demos/nba-shot-chart-vega/)

which includes link for one done in python, and Kirk Goldsberry’s articles on
Grantland.

------
ssharp
Steph Curry's 2015-16 shot chart is the epitome of sports data analysts
insistence over the past few years that three pointers are far more efficient
shots than most two point shots. Almost all of Steph's shots this year are
either at the basket or behind the three point line.

I guess it just took a generational player, who could shoot not only extremely
accurate from distance, but can also fire of a shot quickly as well as create
his own space for shots, to fully exploit the extremes of that data.

------
crispyambulance
Wait a sec, how does the NBA get the shot data?

It looks like there's positional information in there. Are they collecting
this using machine vision?

~~~
TheBiv
Yes they are, the NBA has cameras mounted in the rafters for this specific
purpose

source: [https://www.washingtonpost.com/sports/wizards/nba-
analytics-...](https://www.washingtonpost.com/sports/wizards/nba-analytics-
movement-includes-placing-six-cameras-in-rafters-at-all-30-team-
arenas/2013/10/25/ac9fc826-3d7a-11e3-b0e7-716179a2c2c7_story.html)

company behind the tech: [http://www.stats.com/sportvu/sportvu-basketball-
media/](http://www.stats.com/sportvu/sportvu-basketball-media/)

