-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdataPlotter.py
More file actions
33 lines (26 loc) · 1.01 KB
/
dataPlotter.py
File metadata and controls
33 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
plane = "FA-18C"
import json
from os.path import join
import matplotlib.pyplot as plt
plt.rcParams['axes.grid'] = True
styleDragIndex = {0: "-", 100: "--", 300: "-."}
plotAltitude = {0: 0, 15000: 1, 30000: 2}
typeWeight = {26000: "b", 50000: "k"}
fileName = join("fuelGraphs", plane + ".json")
f = open(fileName)
finalData = json.load(f)
f.close()
fig, axs = plt.subplots(3)
for i, ax in enumerate(axs):
ax.set_title(f'Altitude {list(plotAltitude.keys())[i]}ft')
if i != 2:
ax.set(ylabel="Specific range [nm / lbs]")
else:
ax.set(xlabel="Mach number [-]", ylabel="Specific range [nm / lbs]")
for altitude in finalData:
for weight in finalData[altitude]:
for dragIndex in finalData[altitude][weight]:
x = [value[0] for value in finalData[altitude][weight][dragIndex]]
y = [value[1] for value in finalData[altitude][weight][dragIndex]]
axs[plotAltitude[float(altitude)]].plot(x, y, typeWeight[float(weight)] + styleDragIndex[float(dragIndex)])
plt.show()