# Get team colors
team_d1 = laps_d1.reset_index().loc[0, "Team"]
team_d2 = laps_d2.reset_index().loc[0, "Team"]
color_d1 = get_team_color(team_d1)
color_d2 = get_team_color(team_d2)
# Create figure
fig, ax = plt.subplots(4, figsize=(16, 12), sharex=True)
# Speed comparison
ax[0].plot(tel_d1["Distance"], tel_d1["Speed"], label=driver_1, color=color_d1, linewidth=2)
ax[0].plot(tel_d2["Distance"], tel_d2["Speed"], label=driver_2, color=color_d2, linewidth=2)
ax[0].set_ylabel("Speed (km/h)")
ax[0].legend()
ax[0].grid(True, alpha=0.3)
# Longitudinal acceleration
ax[1].plot(tel_d1["Distance"], tel_d1["LongAcc"], label=driver_1, color=color_d1, linewidth=2)
ax[1].plot(tel_d2["Distance"], tel_d2["LongAcc"], label=driver_2, color=color_d2, linewidth=2)
ax[1].set_ylabel("Long. Acc (g)")
ax[1].axhline(0, color="white", linestyle="--", alpha=0.5)
ax[1].legend()
ax[1].grid(True, alpha=0.3)
# Lateral acceleration
ax[2].plot(tel_d1["Distance"], tel_d1["LatAcc"], label=driver_1, color=color_d1, linewidth=2)
ax[2].plot(tel_d2["Distance"], tel_d2["LatAcc"], label=driver_2, color=color_d2, linewidth=2)
ax[2].set_ylabel("Lat. Acc (g)")
ax[2].axhline(0, color="white", linestyle="--", alpha=0.5)
ax[2].legend()
ax[2].grid(True, alpha=0.3)
# Driver actions bar chart
action_colors = {"Full Throttle": "lime", "Lift": "grey", "Brake": "red"}
# Plot actions for both drivers
# (simplified - see full example for complete implementation)
ax[3].set_xlabel("Distance (m)")
ax[3].set_ylabel("Driver Actions")
plt.suptitle(f"{session.event.year} {session.event['EventName']} - {session.name}")
plt.tight_layout()
plt.show()