DM-55379 (hotfix): Space WCS axis labels for the post-colorbar axes size - #24
Merged
Conversation
The colorbar is attached with an axes divider that only resizes the image axes on the next draw, but AST measured the label extents against the full-width axes it starts from. The axes then shrank, so wide decimal labels were laid out too densely and overlapped (and the axis title landed on top of the numeric labels). Realise the pending resize before AST measures so it spaces the labels for the final geometry. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A figure resize changes the axes size without changing the view limits, so the debounced redraw that already runs on limit changes now also fires on the canvas resize_event. Without it the labels keep the spacing chosen for the old size and overlap (or spread out) after a drag-resize. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Interactive web backends such as ipympl emit resize_event repeatedly at the size the figure already has, and each rebuild repaints the canvas, which prompts the frontend to report its size again. Rebuilding on every event therefore drove an unbounded repaint loop that only settled once the kernel went idle, leaving the widget blank until then. Split the resize callback from the limit-change callback and rebuild only when the canvas has changed size since it was last drawn, so a drag-resize still re-spaces the labels exactly once while the backend's same-size echo is ignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
The colorbar is attached with an axes divider that only resizes the image axes on the next draw, but AST measured the label extents against the full-width axes it starts from. The axes then shrank, so wide decimal labels were laid out too densely and overlapped (and the axis title landed on top of the numeric labels). Realise the pending resize before AST measures so it spaces the labels for the final geometry.