Live data from Hacker News

How to create NBA shot charts in Python

savvastjortjoglou.com

1–10 of 29 posts

Re: How to create NBA shot charts in Python

#4
Interesting, one of my favourite professors uses Processing for the Introduction to Programming course at my school and decided to make students plot based on an array he pulled from NBA top 10 player data (or at least 10 or so players). Definitely forwarding this one to him, maybe it could be turned into a challenge for students. I wonder how this would look in Processing with Python (it's supported as an addin).

Re: How to create NBA shot charts in Python

#7

I wonder how does NBA generates these data (X, Y position and shot attempts), if it's manually input from video or something smarter

It's automatically extracted from video, using six cameras and a commercial system called SportVU: http://stats.nba.com/tracking/

Re: How to create NBA shot charts in Python

#8
The plots showing the full dataset as a scatter plot on the court are great, and the most useful plots in this post. I also like the outlines of the court (though if I were making these charts I’d draw the court lines in gray or pale orange or something so the data would stand out more).

The heat maps are much less useful IMO, because the colors are poorly chosen and the data generalization/binning methods seem kind of arbitrary. Until the shot count gets up into the tens of thousands or more, just show all the data. (If e.g. aggregating all the shots from the whole league, then some kind of binning would become necessary.)

The marginal histograms showing density by x/y coordinates on the court are essentially useless in my opinion. Dramatically more interesting would be marginal histograms related to angle and distance in terms of polar coordinates centered at the basket (it might be necessary to ignore the angles for positions very close to the basket, where angle is kind of irrelevant). To make them even more informative, since the 3 point line isn’t a perfect semicircle, make marginal distributions (in terms of angle and distance) of separate categories of 2 point and 3 point shots, and stack them. Or even three categories showing dunks/layups, 2 point jump shots, and 3 point jump shots.

Re: How to create NBA shot charts in Python

#9
post #2

Statmuse.com has a really nice implementation of this in their natural-language sport statistics engine. You can see an image here http://i.imgur.com/ukganMx.png ...or if you're in the beta, here: https://www.statmuse.com/nba/search?q=michael%20jordan%20sho...

Just watched their video... I can't believe I have never heard of these guys before!

Looks like they're translating natural-language into some sort of query language. Are there any well-known methods for doing this kind of thing?

Re: How to create NBA shot charts in Python

#10
post #5

We include shot charts on Basketball-Reference.com and allow for side-by-side comparisons as well. http://www.basketball-reference.com/players/h/hardeja01/shoo... http://www.basketball-reference.com/play-index/plus/shooting...

Always wanted to redesign Basketball Reference. Nothing fancy (I can appreciate that the data is king), just clean it up a bit.
Post reply on HN