Files
littlefs/scripts
Christopher Haster 751b89a263 scripts: plot[mpl].py: Made subplot width/height defaults more intuitive
So far, I think the use of ratios for subplot widths/heights has worked
well, with the exception of the default behavior for repeated neighbors
being a bit garbage.

Before, the default was a simple 0.5x of the current row/column:

  ./scripts/csv.py test.csv -xx \
      --subplot="-ya" \
      --subplot-right="-yb -W0.5" \
      --subplot-right="-yc -W0.5" \
      --subplot-right="-yd -W0.5" \
      --subplot-right="-ye -W0.5"

And while this is certainly simple, it's behavior is not the most
intuitive. When -ye takes 0.5x, it takes 0.5x of the _whole_ grid,
squishing -ya + -yb + -yc + -yd into the other 0.5x as needed. As a
result, -ya ends up with 0.0625x of the final grid.

You could argue this is confusing behavior, but I worry trying to make
it "smarter" will just make it more confusing when multiple dirs/
nestings are mixed.

---

But we can at least change the _default_ behavior to be less confusing.

Now, instead of defaulting to 0.5x, we keep a sum of the number of
subplots seen in the current direction (row vs column), and default the
next subplot's width/height to 1/n.

As a result, repeated subplots end up like the following:

  ./scripts/csv.py test.csv -xx \
      --subplot="-ya" \
      --subplot-right="-yb -W0.5" \
      --subplot-right="-yc -W0.3333333" \
      --subplot-right="-yd -W0.25" \
      --subplot-right="-ye -W0.2"

Which may look crazy, but cancels out the nested ratio so the final grid
is a set of evenly distributed columns.

---

Maybe this is still too clever and will need to be reverted in the
future, but in the meantime it provides a nice default for the common
use case of repeated subplots.
2026-03-09 22:57:09 -05:00
..
2025-04-16 15:23:06 -05:00