Skip to content
Snippets Groups Projects
Commit 049c1042 authored by Lennard Geese's avatar Lennard Geese
Browse files

Clean up

parent d74335cb
Branches
Tags
No related merge requests found
...@@ -12,26 +12,22 @@ from DataHandler import DataHandler ...@@ -12,26 +12,22 @@ from DataHandler import DataHandler
# TODO: Adjust input parameters for multiple weather change windows # TODO: Adjust input parameters for multiple weather change windows
class DataPlotter(DataHandler): class DataPlotter(DataHandler):
def plotOvertakesWithTireChangeWindow(self, overtakesPerLap: list[int], firstTireChange: int, lastTireChange: int, raceName: str): 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 firstTireChange -= 1
lastTireChange += 1 lastTireChange += 1
# Define variables
laps: int = len(overtakesPerLap) 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 # Define data range
x_values = np.arange(1, laps + 1) x_values = np.arange(1, laps + 1)
plt.plot(x_values, overtakesPerLap) plt.plot(x_values, overtakesPerLap)
# Paint background between first and last tire change
axis.axvspan(firstTireChange, lastTireChange, color='blue', alpha=0.3)
axis = plt.gca()
# Label stuff # Label stuff
axis.set_xlabel('Lap') axis.set_xlabel('Lap')
...@@ -53,14 +49,6 @@ class DataPlotter(DataHandler): ...@@ -53,14 +49,6 @@ class DataPlotter(DataHandler):
axis.grid(which='minor', alpha=0.2) axis.grid(which='minor', alpha=0.2)
axis.grid(which='major', alpha=0.5) 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.tight_layout()
plt.show() plt.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment