added power plot

This commit is contained in:
ken
2023-07-09 09:32:10 -07:00
parent 7ddfa4e13c
commit d7b4ed1016
3 changed files with 45 additions and 15 deletions
+16 -12
View File
@@ -292,6 +292,7 @@ def plot_OIL(df):
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_OIL.png")
"""
COMPARE OLD 2AXIS commented out, with NEW 2AXIS below...
def plot_BAT(df):
# VBAT, IBAT
fig, ax = plt.subplots()
@@ -404,21 +405,24 @@ def plot_FUEL(df):
def plot_PWR(df):
# see plot_BAT...
# MP, RPM
fig, ax = plt.subplots()
df.plot(ax=ax, y="MP", xlim=(sv+50,len(df)), color='b')
ax.set_ylabel('PSI')
ax.legend(loc='lower center')
ax2=ax.twinx()
df.plot(ax=ax2, y="RPM", xlim=(sv+50,len(df)), color='g')
ax2.set_ylabel("rpm")
ax2.legend(loc='lower right')
fig,axs = plt.subplots(nrows=2, ncols=1, sharex=True)
df.plot(ax=axs[0], y="MP", xlim=(sv+50,len(df)), color='b')
axs[0].set_ylabel('PSI')
#axs[0].legend(loc='lower center')
#ax2=axs.twinx()
df.plot(ax=axs[1], y="RPM", xlim=(sv+50,len(df)), color='g')
axs[1].set_ylabel("rpm")
#axs[1].legend(loc='lower right')
ax=plt.gca()
tick_labels=ax.xaxis.major.formatter.seq
ax.xaxis.major.formatter.seq = [label.split()[-1] if label else "" for label in tick_labels]
ax.xaxis.set_major_formatter(x_format(df))
plt.xticks(rotation=30)
plt.xlabel("Time (MM:SS)")
plt.title(FLIGHTDATE)
if df.index[-1] > pd.Timedelta("01:00:00"):
plt.xlabel("Elapsed Time (HH:MM:SS)")
else:
plt.xlabel("Elapsed Time (MM:SS)")
axs[0].set_title(FLIGHTDATE)
if SAVEPLOTS: savefig(SAVEPATH+FLIGHTDATE+"/"+FLIGHTDATE+"_PWR.png")
+20 -1
View File
@@ -26,6 +26,16 @@
"sys.path.append('../../../programs')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# import importlib\n",
"# importlib.reload(ems_plot_util_nb)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -278,6 +288,15 @@
"plt.grid()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"emsU.plot_PWR(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
@@ -346,7 +365,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.10"
"version": "3.10.11"
}
},
"nbformat": 4,
+8 -1
View File
@@ -6,7 +6,7 @@
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.1
# jupytext_version: 1.14.6
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
@@ -22,6 +22,11 @@
import sys
sys.path.append('../../../programs')
# +
# import importlib
# importlib.reload(ems_plot_util_nb)
# -
from pathlib import Path
# +
@@ -102,6 +107,8 @@ plt.grid()
emsU.plot_CHTdt(d)
plt.grid()
emsU.plot_PWR(d)
print("flight time")
print(d.index[-1])