Thursday, October 12, 2017

Creating Radar Charts in Tableau - A How To

During the international breaks I like to try creating something new, it is nice to get away from the day to day of the club schedule and play around with data.

During this international break I have worked on figuring out a way to replicate Ted Knutson's very popular Radar charts.

My knock off seems to be fairly popular as well so I wanted to give a bit of a rundown on how to create them should you ever want to try it yourself.

This is based on this template that was posted on the tableau blog.

The first step is getting your data ready. For this walk through I am using the creation of my midfield template.

To have the data play nicely with the radar it all must be normalized to the same scale. To do this I will make everything run between 0 and 100. So I identify each set of data and the minimum and maximum value to be used to calculate the value for the radar.

Stat Name M Min Max
Pass% Value M 74 90
Key Passes Value M 0.7 2.5
PPVA Value 0.03 0.55
xG Buildup Value 0.1 0.6
xG+xA Value 0.1 0.5
Drib Value M 0.5 2.1
Disp Value M 2.4 0.5
Fouls Value 2.4 0.6
DribPast% Value 60 20
Suc Tackles Value 1 3
Int Value 1 3
Suc Long Balls Value 0.53

Narrowing the list down to 12 values (I even through on one more than Ted!) is very tough but I feel that this gives a good overview of the different things you want to measure from a midfielder. It has passing, chance creation, overall scoring contribution, dribbles and ball retention, and some defense. It isn't perfect because nothing is and when you make your own you can go crazy with what ever you want to include. The minimum and maximum are at the 95th percentile and the 5th percentile of the stat.


Above is an example of normalizing Passing% to 100. First I have an If statement for values greater than 0.9, then values for below 0.74 and then finally for values in between. To do this you subtract the minimum value and then divide by the spread between minimum and maximum and multiply by 100. 

When done it should look something like this:

So you go through and do this for all of the stats you want to include in the radar. Once you are complete with that go to Analysis -> View Data and select all of the data to copy into an excel sheet.


In the excel sheet you will add a column for the order that you want the stat to show up on the radar.  For this each stat will have this order:

Stat Name M Order
Pass% Value M 1
Key Passes Value M 2
PPVA Value 3
xG Buildup Value 4
xG+xA Value 5
Drib Value M 6
Disp Value M 7
Fouls Value 8
DribPast% Value 9
Suc Tackles Value 10
Int Value 11
Suc Long Balls Value 12
The next step is to create the radar in tableau. So create the new worksheet and add the newly created excel data to the data connection. 

Next is to create the x Value we will use. We will create a calculated field, I am naming mine X-M and enter the values for the X coordinates for each stat: 

CASE [Stat Name M]
WHEN "Pass% Value M" THEN 0
WHEN "Key Passes Value M" THEN [Per90 Stat Value] *(1/2)
WHEN "PPVA Value" THEN [Per90 Stat Value] *(sqrt(3)/2)
WHEN "xG Buildup Value" THEN [Per90 Stat Value]
WHEN "xG+xA Value" THEN [Per90 Stat Value] *(sqrt(3)/2)
WHEN "Drib Value M" THEN [Per90 Stat Value] *(1/2)
WHEN "Disp Value M" THEN 0
WHEN "Fouls Value" THEN [Per90 Stat Value] *(-1/2)
WHEN "DribPast% Value" THEN [Per90 Stat Value] *(-sqrt(3)/2)
WHEN "Tackles Value" THEN [Per90 Stat Value] *-1
WHEN "Int Value" THEN [Per90 Stat Value] *(-sqrt(3)/2)
WHEN "Suc Long Balls Value" THEN [Per90 Stat Value] *(-1/2)
END


And then the same with the Y Values:

CASE [Stat Name M]
WHEN "Pass% Value M" THEN [Per90 Stat Value]
WHEN "Key Passes Value M" THEN [Per90 Stat Value] *(sqrt(3)/2)
WHEN "PPVA Value" THEN [Per90 Stat Value] *(1/2)
WHEN "xG Buildup Value" THEN 0
WHEN "xG+xA Value" THEN [Per90 Stat Value] *(-1/2)
WHEN "Drib Value M" THEN [Per90 Stat Value] *(-sqrt(3)/2)
WHEN "Disp Value M" THEN [Per90 Stat Value] *(-1)
WHEN "Fouls Value" THEN [Per90 Stat Value] *(-sqrt(3)/2)
WHEN "DribPast% Value" THEN [Per90 Stat Value] *(-1/2)
WHEN "Tackles Value" THEN 0
WHEN "Int Value" THEN [Per90 Stat Value] *(1/2)
WHEN "Suc Long Balls Value" THEN [Per90 Stat Value] *(sqrt(3)/2)
END
Next you will add the X-M to the columns aggregated as an average and Y-M to the rows also aggregated as an average.

Next is to drag Stat Name M Dimension to the marks section.

Then you will convert the mark type from Automatic to Polygon.

Then drag the Order Measure to the path section in mark to fix the weird shapes.


Now we have something that looks like a Radar! However right now it is showing all of the values and we need to fix it to show only one player at a time. To do this drag the Players Dimension to the filters section. I then add it to the window as well and change it to select only single values and I also customize the filter to not show the all value.

It should look something like this now:


We are very close now. Now we will add the background image for the radar. For this I took the blank template from here and then added the values around the circle for the stats. It looks like this:
Next it will be added into Tableau. To do this you go to Map -> Background Images -> and then select your data sheet. Then you select where you saved the image and put in the matching coordinates. 

Now we should have a real radar with some minor formatting stuff to make it look pretty to finish!

The formatting that I like to do is to change the color opacity to 65% to be able to see the numbers on the image behind, have each team be assigned a color, remove the axis labels and the center lines. I then put them all in a dashboard with the Per 90 Stats and Minutes information to complete everything. The final product should look like this:


You can find the dashboard and play around with it here

5 comments:

  1. Hi Scott,
    Pretty interesting to do.
    I have a few things to ask, Can I?

    ReplyDelete
  2. Replies
    1. Hi Scott,
      thanks for the reply.
      Just to check with you on the blank template.
      The template has got only 11 parameters.
      how to get the template with 12 parameters.
      I am working on sth. and I am following you on twitter too.
      @zephyr923.

      Delete
  3. Hey Scott. I really want to know whether theres a way you could share the databse you used to make this

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete