scripts: plot[mpl].py: Prioritize subplot subplots before plot subplots

A small tweak, but this resolves some confusing interactions between
subplot subplots and regular subplots.

Consider:

  ./scripts/plot.py test.csv -xx \
      --subplot=" \
          -ya \
          --subplot-below=\" \
              -yab\"" \
      --subplot-right=" \
          -yb \
          --subplot-below=\" \
              -ybb\""

You would normally expect -yab and -ybb to end up side-by-side. But
because regular subplots were parsed fully before subplot subplots, -yab
confusingly ended up beneath the sum of -ya + (-yb + -ybb).

The small tweak of prioritizing subplot subplots fixes this, and
results in the expected 2x2 grid of plots.
This commit is contained in:
Christopher Haster
2026-02-15 00:40:15 -06:00
parent 7ddef7a870
commit 6998a10088
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -1332,7 +1332,7 @@ def main_(ring, csv_paths, *,
# subplot can also contribute to subplots, resolve this here or things # subplot can also contribute to subplots, resolve this here or things
# become a mess... # become a mess...
subplots += subplot.pop('subplots', []) subplots = subplot.pop('subplots', []) + subplots
# allow any subplots to contribute to by/x/y # allow any subplots to contribute to by/x/y
def subplots_get(k, *, subplots=[], **args): def subplots_get(k, *, subplots=[], **args):
+1 -1
View File
@@ -980,7 +980,7 @@ def main(csv_paths, output, *,
# subplot can also contribute to subplots, resolve this here or things # subplot can also contribute to subplots, resolve this here or things
# become a mess... # become a mess...
subplots += subplot.pop('subplots', []) subplots = subplot.pop('subplots', []) + subplots
# allow any subplots to contribute to by/x/y/defines # allow any subplots to contribute to by/x/y/defines
def subplots_get(k, *, subplots=[], **args): def subplots_get(k, *, subplots=[], **args):