Fix plot_spacer theme and arithmetic - #1057
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1057 +/- ##
==========================================
+ Coverage 86.81% 86.87% +0.06%
==========================================
Files 203 203
Lines 13759 13757 -2
Branches 1689 1688 -1
==========================================
+ Hits 11945 11952 +7
+ Misses 1265 1256 -9
Partials 549 549 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
has2k1
force-pushed
the
fix-spacer-theme
branch
2 times, most recently
from
May 4, 2026 12:53
202f65d to
9b2b935
Compare
Promote return types from ggplot/Compose to Self where the body preserves the runtime class — ggplot's __deepcopy__, __add__ overloads, __or__/__truediv__/__sub__/__rrshift__, and Compose's __and__/__mul__. The other Compose operators (__or__, __truediv__, __sub__, __add__) keep Compose as their return type because they cross-construct (e.g. Stack | x → Beside) and would be unsound as Self. Also type the rhs of plot_spacer's __add__/__iadd__ explicitly so the override is visible to pyright.
plot_annotation now controls the composition's figure size and dpi via Compose.theme; the per-spacer values forwarded into __add__ are no longer read by anything.
Compose.__and__/__mul__ apply themes to items via item += rhs, which dispatches to ggplot.__iadd__ → theme.__radd__. For a complete theme that takes the "replace" branch, overwriting the spacer's theme_void() foundation so the spacer paints a panel. Override __iadd__ on plot_spacer to merge only plot_background into the existing theme_void(), and have __add__ delegate via deepcopy → __iadd__ so the merge logic lives in one place. plot_spacer.__add__ used to silently swallow any non-PlotAddable rhs, so spacer + plot was a no-op. Match ggplot.__add__'s contract: ggplot or Compose on the right composes into a Wrap, just like plot + plot. A theme still contributes only its plot_background fill into the spacer's theme_void() foundation. closes #1055
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.
No description provided.