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

Clean up

parent d74335cb
Branches
No related tags found
No related merge requests found
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment