Hi All,

Another quick sports run-through this week.

Fun fact before we start, Jack Grealish broke the record for being fouled more times than any other soccer (football) player last season, with a total of 167 fouls won.

RADAR CHARTS

Radar charts are nothing new in the community but I am hoping to create more of a tableau ‘bridge’ for those that usually create their charts in Python. A radar chart is useful when trying to compare the relative weight or importance of different dimensions within one or more entities. 

This blog post will be split into three sections outlined below. We will be looking to recreate the above visualisation in its entirety.

  1. Python (Optional)

  2. Tableau Build

  3. Figma Design

A few shout-outs before we begin.

Firstly, Mckay Johns, I was looking through his original radar chart python tutorial which paved the way in piecing together my own code. He is killing it in the sports world making python more accessible for all.

Secondly, Toan Hoang. You will see a lot of the calculations are similar, if not the same to Toan’s tutorial of radar charts. It is so easy to follow and would recommend giving it a go, as well as, if not prior to this blog!

Lastly, Autumn Battani for giving me some commentary on the design aspect. You will see in section three how this played out in terms of circular text writing. Autumn has a clear talent for design so I am always looking on ways to improve on this front, from her.

I really owe it to these three individuals for the blog, I am just gluing the ideas together with the odd amendment rather than building anything from complete scratch so all credit goes to them.

PART 1 – PYTHON (OPTIONAL)

You can find the code on Github. I used PyCharm Community to run the code but feel free to use any preference of your own. We will be using the python code simply to create the background for our visualisation. If you would like to gloss over the python aspect, I have saved down a copy of the blank template on the GIT repo.

What happens when we run the code?

It will pop up asking for an input in the terminal. You will need to enter a number representing the number of metrics. In the case of the Jack Grealish dashboard this number was 7 (segments) accounting for Acceleration, Stamina, Strength, Balance, Sprint Speed, Agility and Jumping.

I’ve put some other examples of different segments saved on the GIT Repo so you can pick one suitable for your needs.

Here are some examples:

 

Don’t forget if this is your first time trying this tutorial you may need to pip install numpy and matplotlib in the terminal.

One thing I’m particularly happy with is the final line of code which saves the background as transparent. This will be super helpful for when we bring this image in as a map background on Tableau!

plt.savefig(‘Demo.png’, transparent=True)

A final thing to note before we move on to the build is that I have made the numbers fall between 0-100 as that is what the FIFAINDEX metrics are out of. This is something to be cautious of, especially moving into the tableau section as you will have to find work arounds if you have separate metrics of all different ranges.

PART 2 – TABLEAU

You can access a copy of the original data on git. You will see it only has two columns, the dimension and an associated value between 0 and 100. The data I am using, was taken from the FIFA Index website, here.

Feel free to download the workbook using the link at the top of the page as a starting point for the visualisation.

The Calculations

There are 6 calculations within the workbook.

The first is index, which returns the index of the current row in the partition without any sorting. The next is count of dimension, which totals the number of different segment/categories. The next is Normal Value, where we make the value a decimal between 0 and 1 by dividing by 100. The degrees calculation is where each of the points are rotated. The degrees will be the gap between each of the dimensions.

Finally the X and Y values use sin and cosine to make the points circular. The calculation will include degrees for the set spacing, index for ranking purposes and then the value to be able to give the distance away from the centre, I.e the player value/metric.

Hopefully that all makes sense. Once again, thank you to Toan Hoang for the inspiration and starting basis of the calculations.

You may have noticed I haven’t written all the calcs out as it will be easier to go in and replace the dataset than build from scratch.

The Build

You can go ahead and replace references with your new data, ideally keeping dimension and value named correctly. Value must remain between 0 and 100. This is super important.

Here is an example above, of me replacing the dataset with 10 new dimension and values.

So now we will want to add a background.

Go to Maps – Background Images – datasetname.

Edit the chart to have the following components for X and Y. In Options, Leave lock aspect and always show viz both turned on.

Find the file with the correct segments from my GIT repo, or the python code you have ran, (with input 10).

Set the configuration as below.

Click OK and Apply.

We have just updated our radar chart with the new background we made in Python.

Note:

The axis is fixed on both the x and y between -1 and 1.

-If you’d like to understand more about the technical build please see Toan’s fantastic template.

-If you build it from scratch you will want to double check your nested calculations from his template.

-Play around with the opacity and colours.

-And there we have it. The final visualisation with the chart background snapped on.

-(Side note: If you are struggling to get your alignment of values to the background image using the configuration I gave, otherwise, try making all the points 100 and align them to the edges, then switch the values to your real values.)

PART 3 – FIGMA DESIGN

Finally, I was asked on a recent VizConnect how to make curved writing. 

I have recently come across this plugin on Figma called Arc. Check out the plug-in, here.

Step 1.

Build your dashboard as desired to size without the background.

Here is my 900×600 dashboard without the curved writing.

So now we will want to add the text at the end of each segment.

-Go to dashboard and export the dashboard as an image.

-Load up Figma and download the plug-in.

-Open a new blank project.

-Go to File, Place Image and locate your dashboard image that we want to add text to.

-Next you will want to use the text tool and create labels for. The text tool is the 6th button on the header above signalled with a “T”.

Method 1.

Create the text as one long string with all the dimensions.

-Go to Figma, Plugins, arc while you have your text highlighted.

– Adjust the bend strength to a desired amount, this may take a few re-trys.

Above is the results. A side note would be that I added in extra manual spaces in the text string to space out the words evenly. Then it was a case of making sure the gap between the first and last word was even.

-You’ll notice the text needs to be rotated. I amend my file to -140 degrees to get Acceleration to the top.

-Overlay the file over the original text.

Once you are happy with the sizing and it is overlaid over your original visualisation, you will want to turn down the opacity of the original visualisation. You may need to resize (proportionally) the text to fit round the chart. This is done by clicking on the original image and going to layer pass-through and turning it to 0.

-Next you want to group the original (now transparent) viz with your new text. This will mean that your text can now be saved with the correct proportions. This is because we don’t want to export the visualisation as an image back in, we just want to keep the text! You can group your text and background image through using ctrl/cmd + G, or right click Group selection.

-Finally export the new image and bring it into your Tableau Dashboard as an image!

If all goes well, you will end up with something like this:

A little bit tricky. This was probably only my third time using Figma so apologies if it’s not best practice. I hope I can improve and share simultaneously moving forward. Let me know how you get on.

Method 2

During discussions with Autumn, I wanted to know if the text should face upwards at the bottom. It’s a bit of an open debate as to whether the text should continually wrap around clockwise, or flip and be read from left to right. I’ll let you make up what you prefer. The above tutorial outlines a continual wrap.

If you prefer the second option (the bottom half of the writing facing inwards) then you will need to follow the same procedure as above but make each word individually with its own text wrap/arc and rotation. I won’t be covering it off in detail here, but for comparisons here is the difference below. You will see I made Agility, Sprint Speed, Balance and Strength read left to right.

 

The final thing to check in Tableau once you have your headers in place is that your dimensions are sorted in the correct order!

This is a super important step to take if you have done labelling.

Right click on dimension, go to sort and make sure they are sorted clockwise in the same order as your text labels.

GOING FURTHER

Try playing around with different segment numbers.

Try adding in a different players metrics over the top.

Try making a whole team’s metrics in grid form.

As always, Let me know how you get on with this one. I can be reached on Twitter, @_CJMayes. A simple one in terms of Tableau build, but maybe a few nuances in terms of the background alignment and challenges with Figma curved writing.

LOGGING OFF,

CJ