Skip to content

Commit f3804ea

Browse files
committed
clarify control flow in plot_time_series
1 parent 26d9b3c commit f3804ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/stagpy/time_series.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def plot_time_series(
6262
tstart = ptstart if tstart is None else min(ptstart, tstart)
6363
tend = ptend if tend is None else max(ptend, tend)
6464
fname.extend(vplt)
65-
for ivar, tseries in enumerate(series_on_plt):
65+
for tseries in series_on_plt:
6666
axes[iplt].plot(
6767
tseries.time,
6868
tseries.values,
@@ -74,14 +74,14 @@ def plot_time_series(
7474
ylabel = lbl
7575
elif ylabel != lbl:
7676
ylabel = ""
77-
if ivar == 0:
78-
ylabel = tseries.meta.description
77+
if len(series_on_plt) == 1:
78+
ylabel = series_on_plt[0].meta.description
7979
if ylabel:
8080
axes[iplt].set_ylabel(ylabel)
8181
if vplt[0][:3] == "eta": # list of log variables
8282
axes[iplt].set_yscale("log")
8383
axes[iplt].set_ylim(bottom=conf.plot.vmin, top=conf.plot.vmax)
84-
if ivar:
84+
if len(series_on_plt) > 1:
8585
axes[iplt].legend()
8686
axes[iplt].tick_params()
8787
for time_mark in time_marks:

0 commit comments

Comments
 (0)