TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to create NBA shot charts in Python

253 pointsby ryanbalmost 10 years ago

11 comments

flashmanalmost 10 years ago
Statmuse.com has a really nice implementation of this in their natural-language sport statistics engine. You can see an image here <a href="http:&#x2F;&#x2F;i.imgur.com&#x2F;ukganMx.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;ukganMx.png</a><p>...or if you&#x27;re in the beta, here: <a href="https:&#x2F;&#x2F;www.statmuse.com&#x2F;nba&#x2F;search?q=michael%20jordan%20shot%20chart" rel="nofollow">https:&#x2F;&#x2F;www.statmuse.com&#x2F;nba&#x2F;search?q=michael%20jordan%20sho...</a>
评论 #9980412 未加载
评论 #9983493 未加载
评论 #9982455 未加载
jacobolusalmost 10 years ago
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).<p>The heat maps are much less useful IMO, because the colors are poorly chosen and the data generalization&#x2F;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.)<p>The marginal histograms showing density by x&#x2F;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&#x2F;layups, 2 point jump shots, and 3 point jump shots.
评论 #9983558 未加载
hvsalmost 10 years ago
We include shot charts on Basketball-Reference.com and allow for side-by-side comparisons as well.<p><a href="http:&#x2F;&#x2F;www.basketball-reference.com&#x2F;players&#x2F;h&#x2F;hardeja01&#x2F;shooting&#x2F;2015&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.basketball-reference.com&#x2F;players&#x2F;h&#x2F;hardeja01&#x2F;shoo...</a><p><a href="http:&#x2F;&#x2F;www.basketball-reference.com&#x2F;play-index&#x2F;plus&#x2F;shooting.cgi?player_id=hardeja01&amp;year_id=2015&amp;advanced=compare&amp;comp_pid=jamesle01&amp;comp_year=2015" rel="nofollow">http:&#x2F;&#x2F;www.basketball-reference.com&#x2F;play-index&#x2F;plus&#x2F;shooting...</a>
评论 #9981242 未加载
评论 #9980428 未加载
wallerj77almost 10 years ago
Krossover built an interactive version of this that plays clips of each shot taken. Link here jumps to a brief overview of it <a href="https:&#x2F;&#x2F;youtu.be&#x2F;3MZF_u-6OT4?t=1m5s" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;3MZF_u-6OT4?t=1m5s</a>
markovblingalmost 10 years ago
Very cool! I came across Peter Beshai&#x27;s work a couple of weeks ago - he has a great d3.js visualisation of basketball shots that might be of interest :)<p><a href="http:&#x2F;&#x2F;peterbeshai.com&#x2F;buckets" rel="nofollow">http:&#x2F;&#x2F;peterbeshai.com&#x2F;buckets</a>
raverbashingalmost 10 years ago
I wonder how does NBA generates these data (X, Y position and shot attempts), if it&#x27;s manually input from video or something smarter
评论 #9980328 未加载
lghhalmost 10 years ago
I have a growing interest in statistics, partially coming from a lifelong love of basketball. I am comfortable with Python and have done a few small projects in it. How can I use my Python skill with statistics for more projects like this? Can anyone point me the right way? Does not have to be basketball related at all.
评论 #9982946 未加载
giancarlostoroalmost 10 years ago
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&#x27;s supported as an addin).
_spoonmanalmost 10 years ago
For the life of me, I can&#x27;t figure out how to navigate to this page: <a href="http:&#x2F;&#x2F;stats.nba.com&#x2F;player&#x2F;#!&#x2F;202322&#x2F;tracking&#x2F;shotslogs&#x2F;" rel="nofollow">http:&#x2F;&#x2F;stats.nba.com&#x2F;player&#x2F;#!&#x2F;202322&#x2F;tracking&#x2F;shotslogs&#x2F;</a> I don&#x27;t see &#x2F;shotslogs&#x2F; anywhere on stats.nba.com
评论 #9981582 未加载
ajstarksalmost 10 years ago
A version in Go: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;ajstarks&#x2F;status&#x2F;628262271026876416" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;ajstarks&#x2F;status&#x2F;628262271026876416</a>
评论 #10020285 未加载
joeleetalmost 10 years ago
Goldsberry, Jr!