Blog of Random Thoughts and Pictures

Mini-challenge: Plotting Actions of an Assister

March 1st, 2021
  1. Think of a player who you enjoyed watching at the recent Men’s or Women’s World Cups.
  2. What actions did they perform that were important and why?
  3. Plot the actions and describe how the data supports or contradicts your own analysis.
  4. Write a short text using at most two figures that illustrate your point.

I’ll address this challenge with a view on a player (or set of players as it turns out), and later in the piece I’ll also share some code snippets on how the information was extracted from the StatsBomb data.

Think of a player

The first challenge and I must admit I’m floundering a little already as I can barely remember the Mens 2018 World Cup, bar the eventual winners, the golden boot winner and the best player award.

However the one thing I do like in football is the player assisting goals.
So for this challenge I thought I would look at the one player that came out on top in this regard at the 2018 World Cup and to state the important actions they performed.

However on first glance it is the case that there is a 16 way tie for the most goal assists at the World Cup 2018, well according to Wikipedia, when I head to another site there is a 19 player tie.

So the first thing I’ve done is take the Team names for all the players listed as the top assist players, have a look at all the passes, and especially all the passes that lead to a goal (or more so a shot on goal) and try and find out the top three players that assisted shots on goal.

This lead to a surprise, for me anyway, because the top three that popped out from this exercise was:

  1. Kieran Trippier (England) : 25
  2. Neymar da Silva Santos Junior (Brazil) : 24
  3. Philippe Coutinho Correia (Brazil) : 13

What actions did they perform

Kieran Trippier had 25 passes that lead to a shot on goal.

Figure 1: Kieran Trippier passes that assisted a shot on goal

However Kieran Trippier does not appear on the top player to assist goals chart because for all these passes only one of them lead to an assisted goal (for John Stones).

Now it’s time to look at the Expected Goal plot of the shots that happened, straight after Kieran Trippier gave in the pass for that shot. As far as I can tell Kieran Trippier could have had at least 2, if not 3, other assisted goals, however there are many of those passes that are into areas where the Expected Goal of that next shot is low.


Figure 2: Expected goals from Kieran Trippier passes

It is also worth noting that a larger number of Trippiers actions are from set plays (corners and the like).

So who was the top assistor at the 2018 World Cup, is it Neymar of Brazil ?

Neymar comes in second on the list gathered earlier, however he only assisted 1 goal also.


Figure 3: Expected goals from Neymars passes


Therefore it must be Philippe Coutinho, with 13 passes that assisted a shot on goal and 2 actual goal assists he is the top player in this category.


Figure 4: Expected goals from Philippe Coutinho passes


Or is he ? A little addendum, when I look to the positions that Neymars passes went into and the Expected Goal setting for each one of those shots taken after a Neymar pass, for me he should be the player of note.


FWC 2018 – Group E – SRB v BRA Neymar Jr


Figure 5: Scatter plot of expected goals from Top 3 player passes


A large number of Neymars assists for a shot are close to the goal (120 is the goal line) and central to the goal (40 is the centre of the goal).

Code snippets

I also want to share some of the code snippets that helped gather the data from Statsbomb in regards to this challenge.

Extracting data from competitions.json

I found it handy to extract the season_id from the competitions.json file and using this to find all the matches with teams I was interested in. This also helped to identify which matches in the events folder had to be picked up.

The Assisted Shot Id

When iterating through the passes finding the pass_assisted_shot_id was very handy, but there was a bit that stumped me for a while when a pass didn’t turn into an assisted shot then that id is set as NaN or not a number, which is a little off putting at first.
There are also times when there are duplicate entries for the pass_assisted_shot_id for related events which in one iteration of this code had Kieran Trippier (England) with 37 actions.

        #Find passes with pass_assisted_shot_id set
        if isinstance(passasid, str):
            #If the pass_assisted_shot_id is a nan (Not a Number) then
            # we don't want it. Usually the assisted_shot_id is some hex value

Given that the dataframe of shots for the matches set’s the index name as the Id of the event, well I took me a while to figure how to re-access that index name when doing a compare later on in the code. Of course it’s simple when you see how with the .name.

    for shotOnGoal in matchesShotsOnGoal:
        if ( in assistedShotId):


Thanks to feedback from Eoin O’Brien, Eoin Slattery, Michael Kerley, Oliver Critchfield and David Sumpter as this has lead to a revision of the text and images.

Plotting actions on a pitch

February 14th, 2021


The second element to work on via this course is Plotting actions on a pitch and the purpose is to

  • Loading match data and finding all the shots
  • Plotting shots on the pitch and highlighting goals.
  • Plotting expected goals
  • Plotting passes

The code needed for this lecture is also available at the Github SoccermaticsForPython repo.

Set up

Under the organisation on Github called mmoffoot I used my fork of the SoccermaticsForPython repo into the mmoffoot area.

Then re-used the branch called ‘week1’ covering the changes I had made as of week1 of the course.

As mentioned before I placed the StatsBomb data in a directory higher and then just add a soft link to the source data within the ‘Statsbomb’ folder of this project.

What was coded

This second exercise concentrated on the England vs Sweden Womens World Cup 2019 match and the exercise asked that I :

  1. Create a dataframe of passes which contains all the passes in the match.
  2. Plot the start point of every Sweden pass. Attacking left to right.
  3. Plot only passes made by Caroline Seger (she is Sara Caroline Seger in the database)
  4. Plot arrows to show where the passes went

I made the code changes to and run the code as


The output from this exercise were mainly images, which was nice.

The code provided from the original repo had shots and goals defined for display, and also a nice feature where the size of the circle represented the expected goal (xG) rating of the shot, as calculated by StatsBomb. This xG thing is covered in more depth a little later in the course, but in general terms my understanding is that xG is the probability of that shot being a goal, the higher the xG the more likely that should should have been a goal.

Therefore in the plot, a solid colour with a name is a goal and the less visable circles are shots that were taken but did not end up as a goal.

Figure 1: Shots and Goals England vs Sweden Womens World Cup 2019.


I have a thing about the pitch being green, with markings as white, so that was the one code change I made to this original code. This caused a slight issue with the goals scored by England as they played in white, I made their shots in white and the penalty spot is white. All of this means that it looks like a goal was scored by England from the penalty spot, but the goal scorer is not named. For now I think I’ll leave it as is.

As for the football analysis, there’s 6 shots on goal from within the box for Sweden, with 2 of those chances having a high xG, but were not goals, and one of the goals scored by Eva Jakobsson looks like it was a tough chance to convert, but she managed it. England only had 4 shots on goal from within the box, and even had a chance with a larger xG but didn’t score from it.

Originating Passes

Next up, the creation of a dataframe of passes was relatively straight forward as the StatsBomb data provides a ‘type_name’ of Pass within the data set so they were easy enough to extract. So the first real plot I have ever created is all the originating position of passes of the match for both Sweden and England, with Sweden playing from left to right. Also added a little text at the bottom to highlight the data came from StatsBomb.

Figure 2: Originating Position of Passes in the England vs Sweden Womens World Cup 2019.


That image is a bit of a mess, as in hard to offer any football analysis, so here’s just the Swedish passes.

Figure 3: Originating Position of Passes in the England vs Sweden Womens World Cup 2019.


Now this is a little bit more interesting, no passes by Sweden in with the opposition box.

Passes made by Caroline Seger

Next up, passes made by Caroline Seger (she is Sara Caroline Seger in the database), and for this filtering out by ‘player_name’ is not too hard with the StatsBomb data.

Figure 4: Originating Position of Passes by Caroline Seger (SWE) in the England vs Sweden Womens World Cup 2019.


Given the plot, there is a lot of midfield play by Caroline Seger and of course the next step of plotting arrows to show where the passes went would really add context to this play.

Now to verify that the code I have written for the directional arrows is correct I went searching for video footage of the match, and low and behold, on YouTube there are a set of full match videos for the Womens World Cup 2019 taken from the tactical camera from behind one of the goals. Thankfully the England vs Sweden match is up there too. Now I found it really hard to pick out Caroline Seger, but I did find it easier to identify Rut Hedvig Lindahl, the Swedish goal keeper, and therefore I picked minute 11 (at random) to see if I could correlate the pass on the video and the pass on my plotted pitch.

Figure 5: Match footage of pass by Rut Hedvig Lindahl (SWE) in the England vs Sweden Womens World Cup 2019.


At this very period, this action was a throw out pass by Rut Hedvig Lindahl, so quite distinctive.

Figure 5: Plot of pass by Rut Hedvig Lindahl (SWE) in the England vs Sweden Womens World Cup 2019.


And from my code. Well there was a little gashing of teeth. The tutorial video that goes with this session indicated a different result, with code that was slightly different but thankfully this was corrected by the lecturer at a later date, and therefore I was on the right track. Just goes to show obtaining some sort of footage from a match can help with these things.

So finally we have the plot I was looking for in this whole session.

Figure 4: Passes by Caroline Seger (SWE) in the England vs Sweden Womens World Cup 2019.


From a football analysis view point Caroline Seger was mentioned in the Swedish line up as taking up the Left Defensive Midfield position, and the passes she made show she did indeed play that role, with a preference to progress the ball towards the opposition goal, with one incisive ball into the opposition box.

What was learned

The main take aways, it was great to learn how plotting the direction of the pass with arrows for a player is important, along with verifying a few of the passes via match footage, if at all possible. I know not all matches will have the tactical camera, but more often than not for the higher tier matches there’s footage of a goal or two to be found.

Post Update:

Thanks to Mike for reviewing the content and for rightly pointed out that I had the wrong image in place for the directional passes of Caroline Seger, and the coordinates for England passes was slightly off. Images and associated code have been updated.


Kate all dressed up for jersey day in Spurs jersey circa 1986-87

June 3rd, 2011

It started off as a hard task, what jersey should Kate got for, for Jersey day in her school and then it hit me, Spurs 86/87 the Hoddle/Waddle//Allen year.

Daniel a little messi in the making

August 14th, 2010

The little man Daniel is getting handie with a ball and kitted out in his Barca finest may be hes getting ready for the 2017/18 squad.

New Irish stadium is fantastic, the match not so fantastic

August 11th, 2010

So the first roar, the first national anthems, the first boring match for the new Landsdowne Road. This really was all about the stadium and not the match.

I was looking forward to the match between Ireland and Argentina, but this was no competitive international, this was a bore, as Argentina were pure class, and Ireland just had one tactic, to hoff the ball up front. Messi showed some flashes of magic, he was clearly head and shoulders above everyone else, with the only player showing any stature on the Ireland side was John OShea.

But enough about the game, the Stadium was just fantastic, and I could tell that the minute there was any good, cheering, singing it would reverberate around the ground very quickly, on a big match day Id say this would be awesome.

One little gripe, on important instances during the game the big screens would NOT show a replay, just a static screen with the new Irish sponsors logo on it. I know they have to do this, but still no replay, was a pain.

So heres to the new Lansdowne Road Mr. Tayto
a href= title=Come on Mister Tayto give us a bag of crisps by miguelpdl, on Flickrimg src= width=374 height=500 alt=Come on Mister Tayto give us a bag of crisps //a

There’s always a first time, “Come on You Boys in Green”

August 8th, 2010

I could barely remember my first time to Lansdowne Road to watch Ireland play football, but I recently came across the ticket stub, and as with any physical item it helps bring some of the memories back.

It was the start of the Jackie Charlton era, his second match in charge and with the arrival of a South America team to Ireland (it was Uruguay), Dad took the chance to crank up the blue Fiat 127 and get it to drag us up to Dublin. I must say the sights and sounds are vague in my mind, it was cold day and so I didn’t enjoy it when we had to stop at the Dart gates just outside the ground to let a train pass. We headed for the West Upper Stand, which I’m sure meant we had to walk in under the Dart line again but anyway for me it was just concrete, grey dark cold concrete everywhere until we got into the stand and up, and up into the gods. I remember the overhead roof being quite long, and the seats, so wooden and old and grey.

The match, well Uruguay scored first, don’t remember the goal, but the feeling of deflation around the ground was definitely memorable.  The biggest excitement of the day was around the Irish goal for sure, which didn’t come too long after the Uruguay one. A penalty taken by the bearded Gerry Daly, scored with aplomb into the South Terrace goal. The cheer was massive, but then the memory starts to fade again as I try and think about whether there was a rendition of “Come on You Boys in Green” at that point, or not, there might have been but I could be wrong. After that the game must have been quite dull as I don’t remember a thing from it, and the match ended as a 1 -1 draw.

Anyway back to the present day and the reason for the post it’s not just a memory of the Old Landsdowne Road, but this week, I get to bring my Dad to the new Aviva Stadium for the first time, in some ways a return trip. The opponents South America again, but this time the mighty, Argentina, sans Maradonna which is a pity.

I’m definitely looking forward to this game, I believe it’s going to be a full house and with the stadium so compact if there is a rendition of “Come on You Boys in Green” I think it will be a good one.

Finally though I do have one small dilemma. You see many months after that match in ’86, Dad had one comment to make, “That fecker I bring him a 100 miles or more to see Uruguay play and he goes and cheers for Ireland!”.  On this return trip I may just make up for that.

World Cup predictions the results

July 17th, 2010

I really shouldn’t post this, but it’s my own fault, just before the World Cup started I posted my predictions and now it’s time to see how it compares to what actually happened.

At the group stages when looking at the top two group qualifiers, I got Group A 100% wrong, with France crashing out, I must say Uruguay really caught me out by surprise. For Group B I was 50% correct Argentina wasn’t hard to pick out, but South Korea did well to pop out of that group. Group C well can I call it 100% right? I picked England and the USA to go through, but then the USA topped the group, so I was 100% wrong. Group D and again Germany went through as expected, but I didn’t realise Australia was in such a shambles. For Group E Holland was correct but Cameroon was a big disappointment, I should have been watching out for the coach change. Group F and on this Slovakia did come through for me, but Italy, sorry olde Italy they are in a serious reverse gear. Group G, Brazil came through but the Ivory Coast didn’t and finally Group H was the only one I got 100% correct, with Spain and Chile.

So at the group stage I made 16 predictions and I had 7 correct. I might as well flicked a coin.

Next to the Round of 16, I made 8 predictions and I had 5 correct, hay this is 62.5% correct not too bad right?

In the Quarter Finals I had Brazil, England, Germany, and Italy for wins, but only one of these came through, Germany.

In the Semi’s I had wins for Brazil and Italy, so nothing there but I did predict a loss for Germany in the Semi’s does that count?

My final pick was Brazil, obviously nothing there, but overall I was delighted to see Spain win, especially given the way Holland went about their task and not withstanding I had Spain in the office sweepstakes.  I had Germany for 3rd place and this was the one final prediction I got correct, well I’m counting it anyway!

My flip mode prediction of South Korea V Paraguay and Mexico V Portugal semi finals with Mexico winning the final didn’t even get close to coming through.

There we go, I enjoyed the World Cup well at least after the first week’s football, I thought the the first week was awful but it picked up after that. So finally a major lesson learned, don’t predict football scores, nor bet on those predictions I wouldn’t make anything from it. I must also stop playing fantasy football games, I only half watch the team line up and I always seem to be up against professionals.

My predictable predictions for the World Cup 2010

June 10th, 2010
FIFA World Cup 2010

FIFA World Cup 2010

Well the World Cup is about to start, so here go the predictions

Group A

Tight group but France South Africa to come through

Group B

Argentina at a stroll and then Nigeria

Group C

England will top the group followed by the USA

Group D

Germany, then Australia

Group E

Holland and Cameroon

Group F

Italy and Slovakia

Group G

Brazil and Ivory Coast (yeap bye bye Ronaldo)

Group H

Spain and Chile

A quick look at this and I have a bad feeling, there are no real teams standing out at the moment breaking the hold of the top teams and while there is always a slow starter, I think Portugal will fall at the first hurdle, but no other surprises.

In the Round of 16 I see wins for South Africa, England, Germany, Argentina, Holland, Brazil, Italy and then Spain. I think Argentina, Italy and Spain may have a tough time in this round, with maybe Cameroon or the Ivory Coast good for coming through instead.

In the quarter finals I have Brazil, England, Germany, and Italy. England may get the hosts SA in this round so that could come down to a penalty shoot out or luck falling on SA. Spain could again drop out in this round, really now Im not seeing them as favourites for the Cup, they will have too many slippery ties.

In the Semis Brazil will have a win over England, and Germany will fall to Italy again.

The final is all for Brazil, with Italy left behind this time and Germany taking the third spot. Its all that simple really.

Most goals scored in the first series could be either Italy or Argentina just because of the teams in their group. With Brazil as winners I also have to go with them as top scorers.

The first nil-nil will be South Korea Vs Greece.

Now having said all of that Id better put my money where my mouth is, so off to Paddy Power.

But before I go one final thing to say, Im useless at predicting soccer scores so if I just go flip mode and reverse all the scores (or winners) Ive predicted in a spreadsheet then I get a semi final line up of

South Korea V Paraguay

Mexico V Portugal

And the winners of the 2010 World Cup will be Mexico. So there goes another each way bet.

World Cup fever is starting to build up, time to look for a schedule

June 1st, 2010

So I was firstly looking for a World Cup calendar schedule and settled on this one from SSIS Junkie {aka Jamie Thomson} and then also came across this great visualisation world cup calendar  (done in flash).

I was also thinking of placing a small bet this year and while I go for outright win from <left blank intentionally> as a gut feeling, I’ve started to use this World Cup 2010 Schedule and Scoresheet spreadsheet to see what team may pop out after I enter all my predicted scores. I’ve managed to get through Groups A, B & C so far.

A tour around the new Landsdowne Road Aviva Stadium

May 18th, 2010

With the new Landsdowne Road Aviva Stadium officially opening up last week I took the opportunity to attend a technology conference event and then take a tour of the new stadium.

The Aviva Stadium at Landsdowne Road

Picture 1 of 7

I have to say it is quite compact (I think 50,000 all seater) and on the fourth tier there was definitely a feeling of vertigo. To my surprise the tour guide allowed us to enter the IRFU presidents room (Directors Box) and we got to walk out the players tunnel onto pitch side.

On the day the stadium was a luscious green alround, but the one thing that surprised me was that the stadium really only has 3 sides which kind of reminds me of a baseball stadium, something like Wrigley Field. I wonder will they ever host a baseball match in the summer?

Anyway given the compactness of the stadium I have no doubt that the first real Landsdowne Roar will be awesome!