Repository navigation
fix(show): resolve axes/panels mismatch for multi-CS elements (#749) - #784
Merged
Merged
Conversation
…749) When an element carries transformations to several coordinate systems that render the same elements (e.g. visium's "<cs>" and "<cs>_downscaled_lowres"; filter_by_coordinate_system can't strip the extra transform, upstream #176), auto-detection produced one panel per coordinate system and `show(ax=single_ax)` raised a "Mismatch between number of matplotlib axes objects and number of panels" ValueError. Deduplicate auto-detected coordinate systems by their renderable-element set when axes are supplied: keep the first of each distinct set so a single axes is satisfied, and warn naming the dropped duplicates (pointing to `coordinate_systems=`). Genuinely distinct coordinate systems keep more sets than axes and still raise the mismatch error. Scoped to the ax-provided, auto-detected path, so the no-ax multi-panel behaviour is unchanged.
timtreis
force-pushed
the
fix/issue-749
branch
from
October 9, 2026 14:37
ea44dfd to
ab0f3cb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #784 +/- ##
==========================================
+ Coverage 80.11% 80.17% +0.05%
==========================================
Files 18 18
Lines 4869 4882 +13
Branches 1081 1085 +4
==========================================
+ Hits 3901 3914 +13
Misses 604 604
Partials 364 364
🚀 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.
Summary
Fixes #749.
pl.show(ax=single_ax)raisedwhen an element carried transformations to several coordinate systems that render the same elements (e.g. visium's
"<cs>"and"<cs>_downscaled_lowres").filter_by_coordinate_systemcan't strip the extra transformation (upstream scverse/spatialdata#176), so auto-detection produced one panel per coordinate system and a single user axes no longer matched.PR #580's
strict_csnarrowing doesn't help here: both coordinate systems contain the same element, so neither is filtered. The two panels are redundant — identical content, differing only by a scale transform.Fix
In
_resolve_coordinate_systems, after the existingstrict_csstep, deduplicate auto-detected coordinate systems by their renderable-element set when axes are supplied: keep the first of each distinct set so a single axes is satisfied, and emit aUserWarningnaming the dropped duplicates and pointing tocoordinate_systems=. Genuinely distinct coordinate systems keep more sets than axes and still fall through to the existing mismatchValueError.Scoped to the ax-provided, auto-detected path only:
axmulti-panel behaviour is untouched.coordinate_systems=is untouched (cs_was_autoisFalse).Tests
test_single_ax_auto_cs_redundant_duplicates_resolved— redundant duplicate CS + single ax now renders one panel and warns (replaces Fix axes mismatch when elements have multi-CS transformations #580's..._unresolvable_raises, whose "raise with hint" stopgap is exactly whatpl.show()leading toValueErrordue to mismatch between number of axes and number of panels #749 supersedes).test_single_ax_auto_cs_distinct_elements_raises— an image-only CS and a shapes-only CS on one axes are genuinely distinct panels and still raise.Non-visual suite passes locally; the only failures are the known CI-only
test_plot_*visual-baseline comparisons. No baseline changes expected (new path exercised only by the non-visual regression tests).