A couple of days ago, I posted a recipe on the F1DataJunkie blog that described how to calculate track position from laptime data.
Using that information, as well as additional derived columns such as the identity of, and time to, the cars immediately ahead of and behind a particular selected driver, both in terms of track position and race position, I revisited a chart type I first started exploring several years ago – race battle charts.
The main idea behind the battlemaps is that they can help us search for stories amidst the runners.
[sourceoce language=’R’]dirattr=function(attr,dir=’ahead’) paste(attr,dir,sep=”)
#We shall find it convenenient later on to split out the initial data selection
if (dir=='ahead') diff_X='diff' else diff_X='chasediff'
if (dir=="ahead") drs=1000 else drs=-1000
#Plot the offlap cars that aren't directly being raced
#Plot the cars being raced directly
In this first sketch, from the 2012 Australian Grand Prix, I show the battlemap for Mark Webber:
We see how at the start of the race Webber kept pace with Alonso, albeit around about a second behind, at the same time as he drew away from Massa. In the last third of the race, he was closely battling with Hamilton whilst drawing away from Alonso. Coloured labels are used to highlight cars on a different lap (either ahead (aqua) or behind (orange)) that are in a track position between the selected driver and the car one place ahead or behind in terms of race position (the black labels). The y-axis is the time delta in milliseconds between the selected car and cars ahead (y > 0) or behind (y < 0). A dashed line at the +/- one second mark identifies cars within DRS range.
As well as charting the battles in the vicinity of a particular driver, we can also chart the battle in the context of a particular race position. We can reuse the chart elements and simply need to redefine the filtered dataset we are charting.
For example, if we filter the dataset to just get the data for the car in third position at the end of each lap, we can then generate a battle map of this data.