Hi all,

Last week we looked at an Alteryx challenge that looked at mapping Messi & Ronaldo’s goals, (Shot Maps In Alteryx Using PolyBuild)

Previously I’ve also blogged about how to obtain shot data through an understat package. Today we will look to blend the two ideas together. I recommend you read both blogs before continuing into this one.

This week;

  • We will add in last years EPL data
  • See if we can plot a shot map for a map, split by team
  • Create a report to be exported into HTML format

Lets revisit our Alteryx Flow and look at the new additions to the flow.

On the left hand side in the top stream. We have our understat data – this is all shots from the Premier League from last year.

The first thing to do with our X & Y co-ordinates is to mirror the co-ordinates based on if they are in the home or away team. Reason for this is we are trying to mirror what is seen on the Understat website.

Currently our data only plots all the data in one side of the pitch.

Next we do some re-scaling that was seen in the previous blog, just to allow the plot points and pitch to be easily rendered.

The middle part of the flow is the exact same as last weeks, we look to create the points and using the polybuild tool for the football pitch.

The only difference here is rather than filter based on Messi & Ronaldo, we are splitting our data out on a specific match_id. For this I have chosen the Manchester City 3-2 Aston Villa game – it was one of the final games last season. You’ll see my choice to split the data out as home and away to then be able to create separate points for each team.

So far so good, we have successfully been able to re-align our data to a pitch.

But lets try take this a little further. We have no context as to the game. Lets take it just a few steps further by adding in a title, header, text context and maybe a table summary of the shots – we can then render this how we like.

The basic table runs along the top of the flow, It needs minimal impact, the table is mainly aesthetics and formatting that you can change, and I took the opportunity to make sure my data was sorted on by minute asc.

Next I look to add a little text for the report,

Perhaps this section would be better if I could automate the values passing through it but for now I am happy as I just want to test the features. This will need manually updating for now, based on which match you choose to design.

This next step is super unnecessary but it’s me and I like to put my logo on things. Here I’ve added a header just with some website details and custom images.

Finally, we can assign an order to how we want to lay these elements out. It takes a bit of back and forth testing different sizes, scales and layouts to find something that may feel best.

Finally I look to export the file, in this case to HTML, but of course you can export to PPT, Image amongst other things.

If you run the flow you will see your render save (as well as export if you haven’t chosen temporary storage) By clicking the render you can see how it appears!

The above two screenshots are how it renders in google chrome. Overall I’m pretty happy with it for a basic report. Of course there is lots more we can go back and add – maybe we can revisit this down the line.

Last thing to note is if you export your files to html, it will also save down all the images needed to render. If these aren’t stored on your computer they wont render in the final version. I.e in this case the logo would disappear and so would actually the shot map as the circles end up displaying as images.

Taking It Further

  • Take a look at a game of your choice
  • Try and automate more of the flow
  • Add in the choice of picking a game rather than manually updating a match ID
  • Amending the layout of the visual
  • Choose a different export type

LOGGING OFF,

CJ