Sitemap

Tableau Guide #1: Making Shot Maps

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

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

7. Click on Add Image

Press enter or click to view image in full size

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

Press enter or click to view image in full size

10. Your ShotMap is now ready

Press enter or click to view image in full size

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.
Press enter or click to view image in full size

Your graph should look like this:

Press enter or click to view image in full size

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

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

4. Go to Format -> Lines

Press enter or click to view image in full size

Make sure your zero lines are ‘None’

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

Press enter or click to view image in full size

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.

Press enter or click to view image in full size

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

Press enter or click to view image in full size

Your Statsbomb themed shotmap is now ready

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Convert your year data-type to Discrete if needed

Press enter or click to view image in full size

Then Drag this ‘year’ to filter and select 2014

Press enter or click to view image in full size

Now you want to edit your colors

Press enter or click to view image in full size

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

Press enter or click to view image in full size

Assign all the other options as White

Press enter or click to view image in full size

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

Press enter or click to view image in full size

Your graph will now look like this

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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’

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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.

Press enter or click to view image in full size

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

Press enter or click to view image in full size

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

--

--

Swaminathan Nanda-Kishore
Swaminathan Nanda-Kishore

Written by Swaminathan Nanda-Kishore

Mostly writing about Football and Data Science | Follow me on the bird App : https://twitter.com/nandy_sd https://twitter.com/NdyStats

Responses (2)