Conversation
…oined subplots Three bugs fixed: 1. Reversed condition (`<` → `>`) for upper-limit check meant the top-edge adjustment almost never fired. 2. Heuristic index-based tick selection replaced with a visibility-window search finding the actual min/max visible tick. 3. FixedLocator now freezes tick positions after a limit expansion to prevent the auto-locator from placing new edge ticks that would recreate the overlap. Also skip _fix_limits for non-linear (e.g. log) y-scales where the linear transform assumption does not hold, avoiding spurious UserWarning from matplotlib. New test module added: tests/stonerplots/test_stack_vertical.py Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix exit code in StackVertical for better subplot adjustments
Fix StackVertical._fix_limits to reliably push joined subplot tick labels inside frame edges
Mar 11, 2026
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
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.
StackVertical._fix_limitsis supposed to expand y-axis limits so tick labels never bleed across the shared frame line into an adjacent panel, but it had three bugs that made the adjustment unreliable or entirely inoperative.Bugs fixed
Reversed condition for upper-limit check —
yticks[-2] < 1.0 - dyshould be>. The top-edge adjustment almost never fired, leaving tick labels on the upper edges of middle/bottom subplots free to overflow into the panel above.Fragile heuristic tick indexing —
yticks[1]/yticks[-2]assumed the auto-locator always places outermost ticks just outside the visible frame. Replaced with an explicit visibility-window search (-0.01 ≤ ta ≤ 1.01in axes units) to find the true extremal visible ticks.Auto-locator feedback loop — after widening
ylim,AutoLocatorrecalculated ticks and could place a new tick at the enlarged boundary, recreating the overflow. AFixedLocatoris now installed whenever limits are changed, freezing tick positions.Algebraic formulas replace approximate transforms
The old code approximated new limits using the pre-adjustment transform, giving slightly wrong results. The new code solves the placement equations directly:
Log-scale axes skipped
Applying the linear-mapping formulas to a log-scale axis produced non-positive limits and a matplotlib
UserWarning. Non-linear y-scales are now detected and skipped early in_fix_limits.Tests
New test module
tests/stonerplots/test_stack_vertical.pycovers bottom/top tick clearance per-panel,FixedLocatorinstallation,joined=False(no-op), 2- and 5-panel stacks, and the single-tick edge case.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.