Skip to content

Commit e5063f1

Browse files
committed
STY Cleaner ylabel for sensitivity plotter
No longer uses conditionals inside format statement, instead uses " ".join([list, of, parts]) Remove an additional re-setting of the xlabel that was missed in GH #405
1 parent b658a82 commit e5063f1

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

serpentTools/parsers/sensitivity.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,16 @@ def plot(self, resp, zai=None, pert=None, mat=None, mevscale=False,
415415
if xlabel is None:
416416
xlabel = "Energy [MeV]" if mevscale else "Energy [eV]"
417417

418-
xlabel = 'Energy [eV]' if xlabel is None else xlabel
419-
ylabel = ylabel if ylabel is not None else (
420-
'Sensitivity {} {}'.format(
421-
'per unit lethargy' if normalize else '',
422-
r'$\pm{}\sigma$'.format(sigma) if sigma else ''))
418+
if ylabel is None:
419+
parts = ["Sensitivity"]
420+
if normalize:
421+
parts.append("per unit lethargy")
422+
if sigma:
423+
parts.append(r"$\pm{}\sigma$".format(sigma))
424+
ylabel = " ".join(parts)
425+
423426
ax = formatPlot(ax, loglog=loglog, logx=logx, logy=logy, legendcols=ncol,
424-
legend=legend, xlabel=xlabel, ylabel=ylabel.strip())
427+
legend=legend, xlabel=xlabel, ylabel=ylabel)
425428
return ax
426429

427430
def _gather_matlab(self, reconvert):

0 commit comments

Comments
 (0)