Skip to content

Add design parameter to plot_layout#1064

Merged
has2k1 merged 4 commits into
mainfrom
design-grid
May 25, 2026
Merged

Add design parameter to plot_layout#1064
has2k1 merged 4 commits into
mainfrom
design-grid

Conversation

@has2k1
Copy link
Copy Markdown
Owner

@has2k1 has2k1 commented May 25, 2026

Adds a design parameter to plot_layout for patchwork-style text-grid layouts. Pass a multi-line string where each character is a cell and identical characters form a rectangular region that hosts one plot or composition item.

design = """
    1##
    123
    ##3
"""
(p1 | p2 | p3) + plot_layout(design=design)

has2k1 added 4 commits May 22, 2026 01:06
`LayoutTree`'s `panel_widths`, `panel_heights`, `plot_widths`,
`plot_heights`, and the four `*_spaces_in_*` collectors inlined
their iteration over the grid. Pull that iteration onto `Grid`
itself via `reduce_cols`, `reduce_rows`, and `items_on_edge` so a
later `DesignGrid` subclass can override the reductions for
`plot_layout(design=...)`. Type dispatch between `PlotSideSpaces`
and `LayoutTree` stays in the tree.

No behavior change.
DesignGrid extends Grid to handle items spanning rectangular regions,
with span-aware reduce_cols, reduce_rows, and items_on_edge methods.
Items contribute their measurement divided by their span to each
affected row/column.
Promote `grid` to a constructor field on `LayoutTree` and move its
construction from `__post_init__` into `create`. The latter now
picks `DesignGrid` over `Grid` when `cmp._design_spec` is set, in
preparation for `plot_layout(design=...)`. No `Compose` writes
`_design_spec` yet, so the `DesignGrid` branch is dormant and
behavior is unchanged.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.09%. Comparing base (9dc3f22) to head (cd1dc0b).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1064      +/-   ##
==========================================
+ Coverage   87.05%   87.09%   +0.04%     
==========================================
  Files         207      208       +1     
  Lines       14195    14317     +122     
  Branches     1764     1788      +24     
==========================================
+ Hits        12358    12470     +112     
- Misses       1278     1284       +6     
- Partials      559      563       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@has2k1 has2k1 merged commit cd1dc0b into main May 25, 2026
13 checks passed
@has2k1 has2k1 deleted the design-grid branch May 25, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant