Tableau Guide #1: Making Shot Maps

The first instalment of the series where I guide you on how to make data visualisations with Tableau

Swaminathan Nanda-Kishore
6 min readJul 15, 2020

Get your Data

To get started, all your data needs to have are X and Y coordinates for the shot locations. Anything apart from that like xG and shot outcome is great as well.

If you already have data from another provider, that’s great. Here’s a 5 line code on R from ewenme that can help you scrape shot location data since the 2014 season from understat. All you need to do is find the number for your particular player and then run the code attached below.

#install the library from github
remotes::install_github('ewenme/understatr')
library(understatr)data1 = get_player_shots(499) #insert playerID heresetwd("~/Downloads") #set your desired export location herewrite.csv(data1,"OzilShot.csv", row.names = FALSE)

Download your Tableau pitch map

Go to James Smith’s website HERE and download the football pitch template. I’d recommend checking out his article here on Medium if you need further help.

Start constructing your visualisation

  1. Open Tableau and import your data file.
  2. Check your coordinate data, they should be in 120, 80 format. If you used the aforementioned understat method, create a calculated field and multiply your X values by 120 and another calculated field where you multiply your Y values by 80.

3. Drag these new measure to columns and rows

4. You want to click on the dropdown and convert these values into dimensions

5. Once you do that for X and Y, you now have the body of your shot map ready and it should look something like this

6. Go to Map -> Background Images -> Data Source

7. Click on Add Image

8. Choose the image, which I had told you to download earlier

9. Since this image has a border of 7 units, these are the values you need to input

10. Your ShotMap is now ready

Cosmetics

Now you can add the final layers of editing that will make your visualisation look really good

  1. This is an optional step, but I like to transpose my graph, which flips the X and the Y axes.

Your graph should look like this:

2. Now double click on your Y axis and X axis

For the X axis, change the range to fixed from 60 to 122

For the Y axis, make sure you click on reversed (don’t click if you haven’t transposed the graph) and set the range to fixed from -2 to 82

3. Once you have fixed the axes, you can go ahead and hide the headers for X and Y.

4. Go to Format -> Lines

Make sure your zero lines are ‘None’

There you have it, Mesut Ozil’s shotmap since 2014

Dashboard Time + Further Polish

Statsbomb Style

Let’s try to make this a Statsbomb style visualisation, you need to drag result to Shape and choose the filled palette.

Now, drag xG to Color and after clicking ‘Edit Colors’, choose a suitable color theme

Your Statsbomb themed shotmap is now ready

Nandy Style Dark Theme Dashboard (yes, I’m shamelessly naming it after myself)

Remove all the formatting you did for the previous chart and change the marks type from automatic to circle

Once again, drag result to color and after clicking color, add a black border

Convert your year data-type to Discrete if needed

Then Drag this ‘year’ to filter and select 2014

Now you want to edit your colors

Double click on goal and choose cyan (I will reveal the reason for choosing this color shortly)

Assign all the other options as White

Now edit your title - Go to Insert -year and adjust alignment and font according to your needs

Your graph will now look like this

Now you want to go ahead and make duplicates of this same sheet. 5 duplicates should do

Go to every different sheet and change the year, the title should automatically update.

Soon, you will be left with 6 sheets for 6 seasons.

Create a Dashboard and change the size to generic desktop browser, the biggest option available.

Now start dragging your sheets onto the dashboard and make sure you click on each sheet and change the view from ‘Entire view’ to ‘Standard’

This is the visualisation you should end up with after removing all the unnecessary filters and legends from the dashboard.

Now you can add a ‘Dashboard’ title, maybe color Ozil in cyan as well, give credit to understat.

Your chart is now ready, go into presentation mode and take a screenshot. You can use annotations to add further details like xG/shot and minutes played.

But remember, I said something about the color cyan, so, on the inverted color scale, cyan is the opposite of red and dark blue is the opposite of yellow etc,.

Now go into MSPaint or a website like pinetools.com and invert your image’s colors. You now have a dark themed shot map that looks like this

I’ll publish more guides and instalments to this series as soon as possible. Thanks for reading

--

--