When plotting a line graph of lap times between two drivers is there a way to have a break between stints instead of the line graph joining the points together the whole time #774
-
Beta Was this translation helpful? Give feedback.
Answered by
Casper-Guo
Aug 2, 2025
Replies: 1 comment
-
|
Plotting with a break in the axis is a bit of a pain in matplotlib but that's probably the cleanest solution For something quick and easy, use 'get_laps' or similar to break up the laps. Then make two separate plot calls. You can keep the line style consistent by getting the style from Fastf1. As for making sure you do not have duplicate legends, this guide may be relevant. I also use the following more general code in my own project: |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
theOehrly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Plotting with a break in the axis is a bit of a pain in matplotlib but that's probably the cleanest solution
For something quick and easy, use 'get_laps' or similar to break up the laps. Then make two separate plot calls. You can keep the line style consistent by getting the style from Fastf1. As for making sure you do not have duplicate legends, this guide may be relevant.
I also use the following more general code in my own project: