-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_functions.py
More file actions
32 lines (28 loc) · 1.18 KB
/
plot_functions.py
File metadata and controls
32 lines (28 loc) · 1.18 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
import matplotlib.pyplot as plt
from itertools import cycle
import numpy as np
def plot_gamma(y_data, x_data, wing_type, legends, line_type=False):
if line_type:
lines = ["-", "--"]
else:
lines = [None]
line_cycle = cycle(lines)
plt.ylabel("Bound circulation (m\u00b2/s)")
plt.xlabel("Span wise axis (m)")
for data in y_data:
plt.plot(x_data, data, linestyle=next(line_cycle))
plt.legend(legends)
plt.title("Bound Circulation for " + wing_type + " Chord distribution")
plt.show()
def plot_a(dataset, wing_type, legends=None):
plt.ylabel("Value of Fourier Series Coefficients")
plt.xlabel("Fourier Series Coefficients")
length = len(dataset)
for k, data in enumerate(dataset):
plt.bar(x=np.arange(1, dataset[0].size + 1) + (k - int(length / 2)) / length, height=data, width=1 / length)
if legends is not None:
plt.legend(legends)
plt.xticks(ticks=range(1, dataset[0].size + 1), labels=['A' + str(j) for j in range(1, dataset[0].size + 1)])
plt.axhline(0, color='black')
plt.title("Fourier Series coefficients for " + wing_type + " Chord distribution")
plt.show()