Hi all,

Welcome back to a new year, I hope the festive period has been one filled with joy for you.

Those of you who know me well, knows tennis is one of my favourite sports, despite not playing it often. Unfortunately, tennis data isn’t as detailed as I really wish it was in terms of being publicly accessible – but it doesn’t stop me from trying to make some creative tennis visuals.

For years, I have wanted better access to shot location data, and its seemingly been hard to find. I did however stumble across the infosys stand when I visited Roland Garros last year and so thought to take a bit of a deeper look at the website.

This blog will look to showcase how you can recreate one of the visuals from the site in Tableau and some of the logic behind it.

If you’d like to follow along, you can find the links to all the resources at the top of the page. The dataset and court image will be stored in the repo, and the visual on my tableau public page.

Let’s take a look at the final from 2022, here.

Rafa ended up winning 3 sets to love in the final of the French Open. 

The exciting part of that is we can navigate to the court vision page and see what some of these shots look like mapped.

Now right away I’m thinking, yeah this is cool, but it’s going to be pretty hard to sketch out in Tableau, so i switch to the 2D mode.

Much better.

Some really smart people are probably able to automate this next bit, but really I wanted just to test if the mapping co-ordinates would work.

First I inspect the page and see the ratio between the height and width of the court.

I use a chrome extension in order to save a copy of the court.

You can find the extension here.

I actually really love this extension because you can also start to use it in terms of helping build out other branding aspects, simply by pasting in the website link. The best part is, because they are SVG’s you can amend the different layers to each of the items.

Here are a few examples from the extension in terms of what the type of output files you can get are.

Anyway I digress, the one we are after is the SVG of the court.

Next let’s download the SVG, constraining the proportions to make sure we keep the right scale in the court.

We can then move this SVG file into Figma to edit.

What you will notice is that we exported it at constrained width and height, but we actually want to make these equal to whatever is on the web page.

This is because we want everything to be proportional.

You’ll see in the output files I scale this up to 708 * 346, but these values will need to be dependent on what you have set your web browse court to.

Reason being, the x and y values on the court also adjust based on the screen. You can test what I mean by changing the size of your web page browse and court.

Now in Figma we have rescaled our court. But I also want to play around a little with how the court is designed. I remove the orange background, opting for a light grey and also thin the stroke of the white out to be a thin black court outline. These are simply aesthetic choices, but don’t impact the proportions of the court.

Next we need our data points. Remembering to keep our court the same size, we can then look through the rfk-court-balls within the html elements to find all the x and y co-ordinates of the shots. In my case I took winner shots. (This dataset is attached at the top of the page in the repo)

Finally, we have our court, and we have our x and y co-ordinates.

Plot your X on columns and Y onto Rows.

Go to Map > Background Images

Add in your court. Remember at the start when I mentioned my court size was based on 708 * 346. 

I halve these values so that my co-ordinates align properly around the centre 0,0.

And there we have it, our tennis court with each winner hit mapped in Tableau. Final thing to do is add some colour, spruce it up a bit.

Going Further;

  • Why not see if you can streamline the data collection process?
  • Add colour to the chart to highlight each player
  • Try mapping a different game from Rolland Garros
  • Try mapping a different shot type metric

LOGGING OFF,
CJ