Tableau’s custom mapping feature can help to visualise spatial fields of sports data. It can plot shots in any sport such as football or basketball, average positions in AFL, as well as many other use cases!
In this blog post I’ll be showing you how to map basketball shots on a half-court in Tableau.


What’s needed


The dataset


For Tableau shot mapping I’ll be using an XML file I found on github, which I had to parse in Alteryx using tools such as XML Parse. The file details all the shots taken in Spain and Serbia’s Eurobasket Group Stage match from 2015. No matter what sport you choose, there needs to be an x and y field in the dataset corresponding to a location on the sporting field. In the example I’m using, the x and y values are in centimetres. It’s important to know the coordinate’s metric for later on.


The image


Next up, find a to-scale image of the sporting field which will be used to map shots on. It’s important to identify the competition the match you’re plotting is a part of, as it may dictate the size of the sporting field and therefore the image. FIBA Basketball Tournaments are played on a 28m x 15m court, which is what I’ll be using, as opposed to the 28.65m x 15.24m courts used in the NBA.
I sourced this image from Google Images before cropping, halving, and editing it for it to be Tableau-ready.

Now that you’ve sourced your dataset and sporting field, let’s get mapping!


Tableau shot mapping tutorial


Step by step


After linking your data source, open a new sheet and drag your x and y fields onto the rows and columns field respectively as averages.
Then, drag a variable to the marks card to uniquely identify each shot. For basketball, as there are four 10 minute quarters, I decided to create a quarter/time hierarchy so that two shots at the same time in different quarters do not clash. By this stage you should have something similar to below.


tableau shot mapping 1

Setting up your sheet


Next, go to the top of Tableau and open up Map > Background Images then select your data source. Browse to the image of your sporting field and select it.
After selecting your image, select the corresponding x and y fields underneath the ‘X Field’ and ‘Y Field’ respectively.
The ‘Right’ and ‘Top’ fields in the window will be how long and wide your field is. These fields are to be in the same scale and metric as your coordinates. As my coordinates are in centimetres and a FIBA Basketball court is 2800cm x 1500cm, the extents of my graph will be 1400cm (as all the shots are plotted on the same half), by 1500cm.
Lastly, all that is left to do now is to ‘Washout’ your image if you chose to, and click OK.


tableau shot mapping 2

Adding your background image


Here’s the result! All you need to do now is apply the appropriate formatting, clean it up a bit and you have your very own shot chart.


tableau shot mapping 3

Basic shot chart


The finished Tableau shot map


So that’s how you do Tableau Shot Mapping! I’ve decided to format mine and include some more stats regarding the players and a time series of points scored (see below).
Once you understand this feature and process it’s easy to plot shots or average positions of your favourite sports. The only tricky thing is finding the data to do so.


tableau shot mapping 4

An example of a shot chart within a dashboard




Joshua Verbeek
Author: Joshua Verbeek

Josh completed a Bachelor of Psychological Science in 2021, with a focus on research. He discovered a great passion for analytics through the degree. Following graduation, he joined a Market Research graduate program working in data engineering. His decision to join the Data School resulted from a desire to perform analyses, gain insights and communicate results in a visually engaging way. Having previously studied and worked within Graphic Design, Josh is particularly interested in the way data is visualised and presented.