Speed Traces
Compare two drivers’ fastest laps by overlaying their speed traces throughout the lap.What This Example Shows
- Loading qualifying session data
- Selecting fastest laps for specific drivers
- Extracting and adding distance data to telemetry
- Using team colors for styling
- Plotting multiple speed traces for comparison
Expected Output
A line plot showing speed (km/h) vs distance (m) for both drivers, with team-colored lines showing where each driver brakes, accelerates, and reaches top speed.Speed Visualization on Track
Visualize speed variations on the track map using a color gradient.What This Example Shows
- Loading GPS coordinates (X, Y) from telemetry
- Creating colored line segments based on speed
- Using
LineCollectionfor gradient coloring - Creating a track map visualization
- Adding a color bar legend
Expected Output
A track map showing the circuit layout colored by speed, with slower sections (braking zones) in one color and faster sections (straights) in another.Corner Annotations
Annotate speed traces with corner numbers and positions.What This Example Shows
- Using
get_circuit_info()to access corner data - Plotting vertical lines at corner positions
- Adding text annotations for corner numbers
- Adjusting plot limits to accommodate annotations
Expected Output
A speed trace with vertical dotted lines marking each corner and numbered labels showing which corner is which.Gear Shifts
Visualize which gear is being used at each point on the track.What This Example Shows
- Accessing gear data (
nGear) from telemetry - Creating a segmented colormap for discrete values
- Plotting gear usage on the track map
- Customizing colorbar ticks for discrete data
Expected Output
A track map colored by gear number, showing where drivers use each gear throughout the lap. Low gears appear in corners, high gears on straights.Key Concepts
Telemetry Data Fields
FastF1 provides access to various telemetry channels:Speed: Speed in km/hRPM: Engine RPMnGear: Current gear (1-8)Throttle: Throttle position (0-100%)Brake: Brake pressureDRS: DRS statusX,Y,Z: GPS coordinates
Adding Distance
Theadd_distance() method calculates the distance traveled from the start of the lap, making it easier to align data from different laps.
Circuit Information
Theget_circuit_info() method provides:
- Corner locations and numbers
- Track rotation for proper map orientation
- Circuit-specific metadata
Telemetry data is only available for sessions from 2018 onwards.
