Analyzing NBA Spacing With Player Tracking Data

Tim Heitman – USA TODAY Sports

There’s so much data out there that’s free for public consumption. It’s pretty amazing. Here’s an example: in every NBA stadium, there are cameras that use tracking technology to collect positional data on the ball and all ten players on the court. While the raw data was taken off of the official NBA Stats website after the 2015-16 season, some of the old logs were saved by a user on GitHub here. It’s not much — a larger sample size would be preferable — but the existence of this data is exciting on its own.

There are many possibilities for what can be done with this tracking data. For instance, I used Python to create the following animation of a play that occurred in the second quarter of a game between the Golden State Warriors and the Detroit Pistons.

Player tracking provides a new perspective on professional basketball and how teams operate. In this play, you can see exactly where the Detroit Pistons went wrong. The Warriors ran a pick-and-roll which Anthony Tolliver and Kentavious Caldwell-Pope defended poorly. A miscommunication led to Draymond Green getting an easy lane to the basket. Once Tolliver arrived to provide help defense, Marcus Morris was left guarding both Stephen Curry and Klay Thompson on the perimeter because Caldwell-Pope did nothing but stand behind Draymond. That’s a recipe for disaster.

You may have noticed the ‘spacing’ tracker for each team at the bottom of the animation. What is spacing? Exactly what it sounds like — how spaced out the players on the floor are. Good spacing is an essential staple of any successful NBA offense. Efficient offenses have the ability to get to the rim and score — just chucking up three-pointers isn’t consistent enough to be sustainable. When the defense is more spread out, the offense has more room to operate and more options.

Here’s an example of good spacing from a 2015 regular season contest between the Golden State Warriors and the Los Angeles Clippers.

The Warriors had a few guys who could shoot the ball. Draymond Green (38.8% 3PT%) and Harrison Barnes (38.3%) were both impactful shooters for the Warriors in their historic 73-9 season, while Stephen Curry (45.4%) and Klay Thompson (42.5%) are arguably the two greatest shooters in league history. Andre Iguodala (35.1%) isn’t a knockdown shooter, but he’s a very good ‘worst’ shooter to have on the floor, with a league-average percentage from beyond the arc. To make matters worse for Los Angeles, the Warriors managed to switch DeAndre Jordan onto Stephen Curry. With excellent spacing and a isolation mismatch, it doesn’t look good for the Clippers. Let’s see what ends up happening.

With that much space and a matchup against a far slower player, it would be embarrassing if Curry didn’t easily blow by him. Fortunately, he did, and all Jordan could do was intentionally foul Curry to force him to earn the two points from the charity stripe (spoiler: he did).

Now, we’ll look to a star-studded matchup between the Los Angeles Lakers and the Memphis Grizzlies for an example of poor spacing.

All five Lakers players are behind the three-point line on this play, which evidently does not concern the Grizzlies’ defense at all. Memphis is instead focusing their attention to guarding the interior, which will make scoring inside far more difficult for the Lakers than it would be if the Grizzlies’ defense was more spread out.

The Grizzlies have three players covering the two-man play between Huertas and Sacre. When Huertas tries to throw up a lob to Sacre, the Grizzlies are in perfect position to prevent it. The Grizzlies are perfectly content with sagging off of Ryan Kelly and Julius Randle on the perimeter.

So, what do these spacing numbers actually mean? In these animations, spacing is quantified through the use of convex hulls (this is not an original idea, credit here). It’s simple — you take the points representing the five players on a single team and draw the smallest possible convex polygon that encloses these points. The area of this polygon represents the spacing for that team at a specific point in time.

We can usually assume that the area of the convex hull for the offensive team will be greater than that of the defensive team. When both values are high, the offense is at an advantage. In the previous example of bad spacing, the offensive spacing is far greater than the defensive spacing which is typically bad for an offense. Well, assuming the defense is reacting correctly. Theoretically, the Warriors would be happy to have a defense not guard their shooters on the perimeter, but that isn’t very likely. NBA defenses react to the offense.

There is a moderate positive correlation between offensive spacing and defensive spacing.

The question I want to explore: which players evoke the largest reactions from the defense? In other words, which players’ presence on the court correlate with an increase in the spacing of the defense? We know that good offense depends on good spacing, so which players actually create good spacing? Presumably the best three-point shooters, but we can go a step further and try quantifying it. Let’s save it for a future article.

Notify of
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Sebastien Darius
4 months ago

Hey, great stuff! I just wanted to know if I could use one of your illustrations as a demo of player tracking for an article I’m writing. Please let me know!