Skip to content

fix(viz): create_small_multiples crashes when commodities fit in one row (#158) - #167

Merged
karlwaldman merged 3 commits into
mainfrom
fix/158-small-multiples-one-row
Nov 15, 2026
Merged

karlwaldman merged 3 commits into
mainfrom
fix/158-small-multiples-one-row

Conversation

@karlwaldman

Copy link
Copy Markdown
Member

Fixes #158. Note: #163's checklist lists this as already fixed by 1e881a1; it was not. On main, create_small_multiples(['A','B']) (default cols=3) still raises.

  • plt.subplots(..., squeeze=False) and always axes[row][col].
  • New tests/unit/test_small_multiples.py, 8 grid shapes. Red on main: 4 failed (every rows==1 case). Green here; full suite 2043 passed, 68 skipped; ruff clean.

🤖 Generated with Claude Code

…e row (#158)

plt.subplots squeezes a 1xN grid to a 1-D array; wrapping it in a list
made axes[col] an ndarray (or IndexError) and TufteStyle.apply raised
AttributeError. Use squeeze=False and always index axes[row][col].

Fixes #158

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcb35d58-3abf-452d-b4db-b8db8eb53d7f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@karlwaldman

Copy link
Copy Markdown
Member Author

Adversarial review: APPROVE.

  • Fix: plt.subplots(..., squeeze=False) always returns a 2-D array, so axes[row][col] is correct for 1xN, Nx1 and 1x1. The old reshaping ([axes], [[ax] for ax in axes]) and the rows > 1 branches are gone, in both the plotting loop and the blank-cell loop.
  • Red/green: reverting visualization.py to main makes 4 of the 8 new cases fail (every rows == 1 shape); on this head all 8 pass. The test asserts the titled axes equal the input codes in order, so empty cells are blank.
  • Test (Python 3.8/3.9) red is the setup-python / Ubuntu 26.04 failure fixed by ci: pin test matrix to ubuntu-24.04 (fixes 3.8/3.9 setup failure) #166; tests never ran. Run locally with matplotlib installed: 3.8.20 2061 passed, 3.9 2061 passed, 3.12 2061 passed, 0 skipped. CI-equivalent .[dev] on 3.8: ruff and mypy clean.
  • CI coverage gap: in CI the whole test_small_multiples.py module is skipped because .[dev] has no matplotlib (job 132628599310: 2028 passed, 15 skipped). Filed [P2] CI skips every CLI and viz test: .[dev] lacks click, rich, matplotlib #169.
  • No secrets. No data-rights wording.

@karlwaldman
karlwaldman merged commit 79f3b8d into main Nov 15, 2026
7 checks passed
@karlwaldman
karlwaldman deleted the fix/158-small-multiples-one-row branch November 15, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:elevated Elevated: auto-merges after an adversarial review APPROVE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create_small_multiples crashes when commodities fit in one row (n <= cols)

1 participant