Tableau Zones on a Pitch
APFA

APFA

December 20, 2022

Tableau Zones on a Pitch

TVA ArticlesVideo

This video details how to create pitch zones on top of a pitch background using Tableau. You can download my workbook on Tableau Public here… How…

This video details how to create pitch zones on top of a pitch background using Tableau. You can download my workbook on Tableau Public here…

How To… 

Step 1: Know the co-ordinates your data provider is using. In this example I am using Statsbomb data which uses a pitch of dimensions 120 x 80. 

Step 2: Build your Zones template file. In the example above3 I used 12 zones, but you could have as many as you need. This takes a little time but remember this file is re-usable so once you have it built you can use it over and over again. If you want to use the example I made you can download it here…

Step 3: We now need to ‘join’* the template file to the raw xy data. I have done this using an IF statement, but there are other ways this could be achieved. Below is a copy of my IF statement that you can use. 

IF FLOAT([Location 0]) <= 30 AND FLOAT([Location 1]) <= 20 THEN 1

ELSEIF Float([Location 0]) <= 30 AND  FLOAT([Location 1]) <= 60  THEN 2

ELSEIF FLOAT([Location 0]) <= 30 AND  FLOAT([Location 1]) <= 80  THEN 3

ELSEIF FLOAT([Location 0]) <= 60 AND FLOAT([Location 1]) <= 20 THEN 4

ELSEIF Float([Location 0]) <= 60 AND  FLOAT([Location 1]) <= 60  THEN 5

ELSEIF FLOAT([Location 0]) <= 60 AND  FLOAT([Location 1]) <= 80  THEN 6

ELSEIF FLOAT([Location 0]) <= 90 AND FLOAT([Location 1]) <= 20 THEN 7

ELSEIF Float([Location 0]) <= 90 AND  FLOAT([Location 1]) <= 60  THEN 8

ELSEIF FLOAT([Location 0]) <= 90 AND  FLOAT([Location 1]) <= 80  THEN 9

ELSEIF FLOAT([Location 0]) <= 120 AND FLOAT([Location 1]) <= 20 THEN 10

ELSEIF Float([Location 0]) <= 120 AND  FLOAT([Location 1]) <= 60  THEN 11

ELSEIF FLOAT([Location 0]) <= 120 AND  FLOAT([Location 1]) <= 80  THEN 12

END

Step 4: Because I know I want to label the middle of the polygons I need to build a modified XY. This simply finds the centre point of each zone. 

  • Mod X: (min([X]) + max([X])) /2
  • Mod Y: (min([Y]) + max([Y])) /2

Drag Mod X to Columns and Mod Y to rows. 

Step 5: Drag Shape # to Detail and Path to Path

Step 6: Add a border (under colour) to see the zone lines. 

Step 7: Add your measure to colour. I built a pass % measure but again you could use anything here. 

Adding the Labels

Step 8: Ctrl and Drag the Mod X pill to make a copy of it on the columns shelf. 

Step 9: Remove Path and Measure (pass %) from Colour. 

Step 10: Add Pass % to Label. Format as needed

Step 11: Right click on the second green Mod X pill in the columns shelf. Select Dual Axis. 

Step 12: Right click on one of the X axis’ and select Synchronize. 

Step 13: You should now have your dual axis pitch map with zones. From here just remove all the chart junk and add filters as needed. 

* I’m using Tableau’s new Relationship data model here – the steps will be different if using the old model.