I’ve been trying to learn how to use NumPy and Matplotlib for Python and for practice I decided to use Stoke’s goals for and against and Stoke’s “expected goals” for and against as datasets.
Here’s a few graphs I made, based on that data. The “expected goals” data is from the Infogol app - it does tend to vary depending on the source.
Analyse these to your heart’s content. I think the most interesting thing I noticed is how after the bad start, we should have turned it around immediately, based on xG, but the results actually started improving when our xG against went
higher than xG for. The difference graph really highlights that. It seems our opponents were creating more chances, but either due to bad finishing or improved goalkeeping (or a bit of both), we conceded less.
The 5 game moving average charts start at 5 on the x-axis as the first point represents matches 1-5, the second point is matches 2-6 and so on.
If you want to see other types of graph, I’m happy to make them for my coding practice.
Goals and xG for and against per match (Goals are dots, xG is bars):
![](https://i.ibb.co/0y4sBkj/Gx-G-chart.png)
Goals for and against moving average:
![](https://i.ibb.co/ZNN7c3q/G-moving-average.png)
xG for and against moving average:
![](https://i.ibb.co/X2LW5fJ/x-G-moving-average.png)
Goals minus xG (“difference”) moving average:
![](https://i.ibb.co/QYNMQsN/Gx-G-moving-average-difference.png)