From 049c1042af29fec830ca0ac782aa89b28e5e3a58 Mon Sep 17 00:00:00 2001
From: Lennard Geese <lennard.geese@sva.de>
Date: Wed, 9 Apr 2025 17:29:53 +0200
Subject: [PATCH] Clean up

---
 DataPlotter.py | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/DataPlotter.py b/DataPlotter.py
index d0bbb6d..31bc04a 100644
--- a/DataPlotter.py
+++ b/DataPlotter.py
@@ -12,26 +12,22 @@ from DataHandler import DataHandler
 # TODO: Adjust input parameters for multiple weather change windows
 class DataPlotter(DataHandler):
     def plotOvertakesWithTireChangeWindow(self, overtakesPerLap: list[int], firstTireChange: int, lastTireChange: int, raceName: str):
-
-        # TODO: Account for cases where no tire changes (meaning values of 0 or -1)
-        # TODO: Let visualization start at 0, but graph at 1
-        # Adjust values
-        #overtakesPerLap.insert(0, 0) # Insert 0th lap, which cannot have overtakes
         firstTireChange -= 1
         lastTireChange += 1
 
-
+        # Define variables
         laps: int = len(overtakesPerLap)
-        plt.xlim(0, laps + 1) # set x-range of plot
+        axis = plt.gca()
 
+        # Set x-range of plot
+        plt.xlim(0, laps + 1)
 
         # Define data range
         x_values = np.arange(1, laps + 1)
         plt.plot(x_values, overtakesPerLap)
 
-
-
-        axis = plt.gca()
+        # Paint background between first and last tire change
+        axis.axvspan(firstTireChange, lastTireChange, color='blue', alpha=0.3)
 
         # Label stuff
         axis.set_xlabel('Lap')
@@ -53,14 +49,6 @@ class DataPlotter(DataHandler):
         axis.grid(which='minor', alpha=0.2)
         axis.grid(which='major', alpha=0.5)
 
-        # Add legend
-        axis.legend(bbox_to_anchor=(1.0, 1.02))
-
-        # Paint background between the first and last tire change
-        axis.axvspan(firstTireChange, lastTireChange, color='blue', alpha=0.3)
-
-
-
         plt.tight_layout()
         plt.show()
 
-- 
GitLab