-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualisasion.py
57 lines (44 loc) · 1.95 KB
/
visualisasion.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from matplotlib import pyplot as plt
def plot_results(x, y1, y1_smooth, y1_fit,
y2, y2_smooth, y2_fit):
"""
Строит два графика (deltaP и p_prime) в отдельных сабплотах.
"""
fig, axs = plt.subplots(1, 2, figsize=(12, 5))
axs[0].plot(x, y1, 'o', label='raw deltaP')
axs[0].plot(x, y1_smooth, 's-', label='smoothed deltaP')
axs[0].plot(x, y1_fit, 'r--', label='cubic approx')
axs[0].set_title('deltaP')
axs[0].legend()
axs[0].grid(True)
axs[1].plot(x, y2, 'o', label='raw p_prime')
axs[1].plot(x, y2_smooth, 's-', label='smoothed p_prime')
axs[1].plot(x, y2_fit, 'r--', label='cubic approx')
axs[1].set_title('p_prime')
axs[1].legend()
axs[1].grid(True)
plt.suptitle("Сглаживание и кубическая аппроксимация для двух временных рядов")
plt.show()
def plot_loglog(df):
"""
Функция принимает датафрейм с колонками:
- 'timestamp' (время, ч)
- 'deltaP' (давление, атм)
- 'p_prime' (давление, атм)
Строит логарифмический график (log-log) обеих кривых на одном поле.
"""
plt.figure(figsize=(8, 6))
# Строим логарифмический график deltaP
plt.loglog(df['timestamp'], df['deltaP'], 'o-', label='deltaP')
# Строим логарифмический график p_prime
plt.loglog(df['timestamp'], df['p_prime'], 'o-', label='p_prime')
# Подписи осей
plt.xlabel('Время, час (log scale)')
plt.ylabel('Давление, атм (log scale)')
# Заголовок и легенда
plt.title('Зависимость давления от времени (log-log)')
plt.legend()
# Сетка
plt.grid(True, which='both', ls='--')
# Отображаем график
plt.show()