Setup Matplotlib
Before creating visualizations, configure matplotlib for optimal F1 data plotting:Setup Options
mpl_timedelta_support: Enables proper formatting of lap times and time deltas on plot axes. Essential for plottingLapTime, sector times, and other timedelta values.color_scheme: Set to'fastf1'for the signature dark theme with optimized colors, orNonefor default matplotlib styling.
Team Colors
FastF1 automatically provides official F1 team colors for any session:Using Team Colors in Plots
Driver Styling
Apply consistent driver-specific colors and line styles to plots:Sorted Driver Legends
Automatically sort legend entries by team and driver order:Custom Driver Styles
Define custom styling variants while keeping official team colors:'auto' is replaced with the official team color automatically.
Tire Compound Colors
Visualize tire strategies with official compound colors:Tire Strategy Visualization
Telemetry Visualization
Speed Traces
Gear Visualization on Track Map
Available Plotting Functions
FastF1’s plotting module provides these key functions:Best Practices
- Always call
setup_mpl()before creating plots - Enable timedelta support when plotting lap times:
setup_mpl(mpl_timedelta_support=True) - Pass the session object to color/style functions for accurate season data
- Use
pick_quicklaps()to filter outlier lap times before visualization - Invert Y-axis for time-based plots so faster times appear at the top
- Use official colors via
get_team_color()andget_driver_style()for professional appearance
Next Steps
- Learn about data analysis techniques for extracting insights
- Explore performance optimization for faster plotting
- See the API Reference for complete plotting documentation
