Add design parameter to plot_layout#1064
Merged
Merged
Conversation
`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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a design parameter to
plot_layoutfor 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.