
Understanding the Visualization
In a lap time heatmap:- Rows represent drivers (sorted by average pace)
- Columns represent lap numbers
- Colors indicate lap time performance:
- Green/cooler colors = faster laps
- Red/warmer colors = slower laps
- Blank cells (background color) = pit laps, deleted laps, or laps slower than the cutoff
Loading the Session
Analyze the 2023 Monaco Grand Prix race to see how drivers performed throughout the event. Rain fell late in this race. Every lap after lap 51 is slower than the 107% cutoff, so the heatmap ends at lap 51.Preparing the Data
Convert lap times to seconds and filter out invalid laps for cleaner visualization.Creating the Pivot Table
Reshape the data so drivers are rows and lap numbers are columns.Visualizing with Seaborn
Use the seaborn heatmap function to draw the chart.Interpreting the Heatmap
When analyzing a lap time heatmap, look for:- Vertical patterns: Consistent colors down a column indicate similar pace across all drivers on that lap. Safety car laps are usually slower than the cutoff, so they show as blank columns
- Horizontal patterns: Gradual color shifts across a row show tire degradation or fuel load effects
- Gaps: Blank cells indicate pit stops or filtered-out laps
- Sudden changes: Abrupt color shifts may indicate incidents, traffic, or mistakes
- Consistent greens: Drivers with predominantly green rows had strong, consistent pace
Adding Fuel Correction
To compare true pace, apply fuel correction to account for the decreasing fuel load:Parameters
The native function exposes the same filters as parameters.laptime_cutoff drops laps slower than fastest * cutoff and fixes the color scale to that range. include_deleted and include_pit_laps keep those laps when True. cmap and xticklabels control the styling:
Complete Example
The whole workflow above is wrapped in a single native function:Advanced Variations
Compare Specific Drivers
Focus on a subset of drivers for detailed comparison:Annotate with Lap Times
Add actual lap time values to cells for precise analysis:Next Steps
- Combine with tire strategy visualization to correlate pace with compounds
- Analyze specific stint performance by filtering lap ranges
- Compare heatmaps across different races to identify track-specific patterns
- Use clustering algorithms to group drivers with similar pace profiles