added plot title

This commit is contained in:
2024-12-05 11:08:42 +01:00
parent 3a71ede917
commit 1b4a8bcd57
+6 -6
View File
@@ -63,14 +63,13 @@ def fd(rho: float, velocity_kmh: float, c_val: float, area: float):
return res return res
plot.figure()
# Fd vs. velocity, param: temperature # Fd vs. velocity, param: temperature
temps_list = [-20, -10, 0, 10, 20, 30] temps_list = [-20, -10, 0, 10, 20, 30]
vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160] vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160]
reference = fd(rho(20), 100, c_val_id3, area_id3) reference = fd(rho(20), 100, c_val_id3, area_id3)
temps_list_leg = [f"{t}°C" for t in temps_list] temps_list_leg = [f"{t}°C" for t in temps_list]
plot.figure()
for temp_degc in temps_list: for temp_degc in temps_list:
rho_t = rho(temp_degc) rho_t = rho(temp_degc)
y_fd = [] y_fd = []
@@ -80,13 +79,12 @@ for temp_degc in temps_list:
plot.plot(vel_list, y_fd) plot.plot(vel_list, y_fd)
plot.ylabel("Wind-Widerstand [%]") plot.title("Windwiderstand vs Geschwindigkeit")
plot.ylabel("Windwiderstand [%]")
plot.xlabel("Geschwindigkeit [km/h]") plot.xlabel("Geschwindigkeit [km/h]")
plot.legend(temps_list_leg) plot.legend(temps_list_leg)
plot.grid() plot.grid()
plot.figure()
# Fd vs. velocity, param: car # Fd vs. velocity, param: car
temp = 20 temp = 20
vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160] vel_list = [20, 40, 60, 80, 100, 120, 130, 140, 160]
@@ -95,6 +93,7 @@ car_list_leg = [f"{t['car']}" for t in car_list]
rho_t = rho(temp) rho_t = rho(temp)
reference = fd(rho_t, 100, c_val_id3, area_id3) reference = fd(rho_t, 100, c_val_id3, area_id3)
plot.figure()
for car in car_list: for car in car_list:
y_fd = [] y_fd = []
for vel_kmh in vel_list: for vel_kmh in vel_list:
@@ -103,8 +102,9 @@ for car in car_list:
plot.plot(vel_list, y_fd) plot.plot(vel_list, y_fd)
plot.ylabel("Wind-Widerstand [%]") plot.ylabel("Windwiderstand [%]")
plot.xlabel("Geschwindigkeit [km/h]") plot.xlabel("Geschwindigkeit [km/h]")
plot.title("Windwiderstand vs Geschwindigkeit")
plot.legend(car_list_leg) plot.legend(car_list_leg)
plot.grid() plot.grid()
plot.show() plot.show()