Skip to content

Commit

Permalink
Add finishing-order driver pace comparison plot
Browse files Browse the repository at this point in the history
README graphics now use tight_layout
  • Loading branch information
Casper-Guo committed Nov 25, 2024
1 parent ea64360 commit 9639c51
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 5 deletions.
Binary file added Docs/visuals/driver_pace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/laptime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/podium_gap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/strategy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/team_pace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/teammate_box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/visuals/teammate_violin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The dashboard and visualizations in this README are updated every Monday at midn
<summary>
<b>Podium Finishers Gap to Winner</b>
</summary>
<img src="Docs/visuals/podium_gap.png">
<img src="Docs/visuals/podium_gap.png" alt="podium gap>
<details>
<summary>
<b>Function call:</b>
Expand All @@ -65,15 +65,15 @@ The dashboard and visualizations in this README are updated every Monday at midn
<b>Teammate Pace Comparisons</b>
</summary>
Boxplot visualization:
<img src="Docs/visuals/teammate_box.png">
<img src="Docs/visuals/teammate_box.png" alt="teammate pace boxplot">
<details>
<summary>
<b>Function call:</b>
</summary>
<code>driver_stats_distplot(season, event, violin=False, swarm=False, teammate_comp=True, drivers=20)</code>
</details>
Violinplot with all laptimes:
<img src="Docs/visuals/teammate_violin.png">
<img src="Docs/visuals/teammate_violin.png" alt="teammate pace violinplot">
<details>
<summary>
<b>Function call:</b>
Expand All @@ -84,9 +84,22 @@ The dashboard and visualizations in this README are updated every Monday at midn

<details>
<summary>
<b>Team Pace Comparisons</b>
<b>Driver Pace Comparison</b>
</summary>
<img src="Docs/visuals/team_pace.png">
<img src="Docs/visuals/driver_pace.png" alt="driver pace comparison">
<details>
<summary>
<b>Function call:</b>
</summary>
<code>driver_stats_distplot(season, event, violin=True, swarm=True, teammate_comp=False, drivers=20)</code>
</details>
</details>

<details>
<summary>
<b>Team Pace Ranking</b>
</summary>
<img src="Docs/visuals/team_pace.png" alt="team pace comparison">
<details>
<summary>
<b>Function call:</b>
Expand Down
16 changes: 16 additions & 0 deletions f1_visualization/readme_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
y=f"GapTo{race_winner}",
grid="both",
)
plt.tight_layout()
plt.savefig(dest / "podium_gap.png")

logger.info("Making lap time graph...")
Expand All @@ -103,6 +104,7 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
event=round_number,
session_type=session_type,
)
plt.tight_layout()
plt.savefig(dest / "strategy.png")

logger.info("Making position change graph...")
Expand All @@ -111,6 +113,7 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
event=round_number,
session_type=session_type,
)
plt.tight_layout()
plt.savefig(dest / "position.png")

logger.info("Making teammate comparison boxplot...")
Expand All @@ -122,6 +125,7 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
swarm=False,
teammate_comp=True,
)
plt.tight_layout()
plt.savefig(dest / "teammate_box.png")

logger.info("Making teammate comp violinplot...")
Expand All @@ -132,8 +136,19 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
teammate_comp=True,
upper_bound=7,
)
plt.tight_layout()
plt.savefig(dest / "teammate_violin.png")

logger.info("Making driver pace plot...")
viz.driver_stats_distplot(
season=season,
event=round_number,
session_type=session_type,
upper_bound=7,
)
plt.tight_layout()
plt.savefig(dest / "driver_pace.png")

# use basic fastf1 to make team pace comparison plot
logger.info("Making team pace comparison graph...")
p.setup_mpl(misc_mpl_mods=False)
Expand Down Expand Up @@ -166,6 +181,7 @@ def main(season: int, round_number: int, grand_prix: bool, update_readme: bool):
plt.title(f"{CURRENT_SEASON} {event_name}")
plt.grid(visible=False)
ax.set(xlabel=None)
plt.tight_layout()
plt.savefig(dest / "team_pace.png")

# Copy the visualizations
Expand Down

0 comments on commit 9639c51

Please sign in to comment.