Skip to content

Commit

Permalink
Pressure-volume plots can span multiple pages - columns and rows spec…
Browse files Browse the repository at this point in the history
…ified in settings
  • Loading branch information
emilwalsted committed Jul 6, 2021
1 parent c6c94a8 commit 7c01495
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions respmech.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,8 @@ def savepvbreaths(file, breaths, flow, volume, poes, pgas, pdi, settings, averag
pass

nobreaths = len(breaths)
maxnocols = 4
maxnorows = 5
maxnocols = settings.output.diagnostics.pvcolumns
maxnorows = settings.output.diagnostics.pvrows
plotsperpage = maxnocols * maxnorows
nopages = -(-nobreaths // plotsperpage)

Expand Down Expand Up @@ -834,15 +834,17 @@ def savepvbreaths(file, breaths, flow, volume, poes, pgas, pdi, settings, averag
from matplotlib.backends.backend_pdf import PdfPages
with PdfPages(savefile) as pdf:
no=0
tno=0
pno = 1
for breathno in breaths: #for no in range(1, nobreaths+1):
no += 1
tno += 1
if (no == 1):
fig, axes = plt.subplots(nrows=norows, ncols=nocols, figsize=(21,29.7))
if averages:
plt.suptitle("Averages - Campbell diagrams (page " + str(pno) + " of " + str(nopages), fontsize=48)
plt.suptitle("Averages - Campbell diagrams (page " + str(pno) + " of " + str(nopages) + ")", fontsize=48)
else:
plt.suptitle(file + " - Campbell diagrams (page " + str(pno) + " of " + str(nopages), fontsize=48)
plt.suptitle(file + " - Campbell diagrams (page " + str(pno) + " of " + str(nopages) + ")", fontsize=48)

breath = breaths[breathno]
if breath["ignored"]:
Expand Down Expand Up @@ -886,7 +888,7 @@ def savepvbreaths(file, breaths, flow, volume, poes, pgas, pdi, settings, averag
wobelpolygon = Polygon([[p[0], p[1]] for p in [eelv, eilv, [eilv[0], eelv[1]]]], alpha=afill, color="#999999", fill=True )
ax.add_patch(wobelpolygon)

if (no == plotsperpage) or (no == nobreaths):
if (no == plotsperpage) or (tno == nobreaths):
plt.figtext(0.99, 0.01, CREATED + " on " + datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'), horizontalalignment='right')
pdf.savefig()
plt.close(fig)
Expand Down Expand Up @@ -1412,6 +1414,8 @@ def analyse(usersettings):
"savepvaverage": true,
"savepvoverview": true,
"savepvindividualworkload": true,
"pvcolumns": 2,
"pvrows": 2,
"savedataviewraw": true,
"savedataviewtrimmed": true,
"savedataviewdriftcor": true
Expand Down

0 comments on commit 7c01495

Please sign in to comment.