Visualize track temperature changes throughout a session
Track temperature has a large effect on F1 performance. It affects tire grip, degradation, and overall lap times. Visualize how track temperature evolves during a session. This shows the conditions drivers faced and their possible effect on strategy.
Weather data is automatically included in the laps DataFrame. Each lap has associated weather information like track temperature, air temperature, humidity, and more.
# Get laps from the driver who completed the most lapslaps = session.lapsdriver_counts = laps.groupby('Driver')['LapNumber'].count()most_laps_driver = driver_counts.idxmax()# Filter to that driver's lapsdriver_laps = laps.pick_drivers(most_laps_driver)
The native function accepts the shared filters. With no drivers, it automatically uses the driver with the most recorded laps. This is the logic shown above. Pass a list to draw one line per driver:
import tif1# Single line for the busiest driver (default)fig, ax = tif1.plot_track_temperature(2023, 'Monaco', 'R')plt.show()# One line per selected driverfig, ax = tif1.plot_track_temperature(2023, 'Monaco', 'R', drivers=['VER', 'LEC'])plt.show()
The session’s weather data must be available (it is included in the laps by default).
The whole workflow above is wrapped in a single native function:
import tif1import matplotlib.pyplot as plt# One call: loads the race and plots the track temperature across the lapsfig, ax = tif1.plot_track_temperature(2023, 'Monaco', 'R')plt.show()# Or save straight to a file# tif1.plot_track_temperature(2023, 'Monaco', 'R', save_path="track_temperature.png")