Visualize the fastest lap from the 2023 Monaco Grand Prix qualifying session.
import tif1import matplotlib.pyplot as pltfrom matplotlib.collections import LineCollectionimport numpy as np# Load qualifying sessionsession = tif1.get_session(2023, 'Monaco', 'Q')# Get the fastest lapfastest_lap = session.laps.pick_fastest()
The native chart accepts the shared filters and a few chart-specific options. The cmap parameter changes the color scale, and save_path writes the figure directly:
import tif1# Custom colormap, saved straight to a filefig, ax = tif1.plot_track_speed_map( 2023, 'Monaco', 'Q', cmap='viridis', save_path='track_speed_map.png', dpi=300,)plt.show()
The default cmap='plasma' matches the chart above.
The whole workflow above is wrapped in a single native function:
import tif1import matplotlib.pyplot as plt# One call: loads the session and draws the speed-colored track mapfig, ax = tif1.plot_track_speed_map(2023, 'Monaco', 'Q')plt.show()# Or save straight to a file# tif1.plot_track_speed_map(2023, 'Monaco', 'Q', save_path='track_speed_map.png')