plot: center axis label glyph boxes in canvas coordinates - #806
Open
mikamikasuki wants to merge 1 commit into
Open
mikamikasuki wants to merge 1 commit into
mikamikasuki wants to merge 1 commit into
Conversation
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.
Centered axis labels are drawn at the canvas midpoint, but their glyph boxes used the normalized arithmetic midpoint of the data range. On logarithmic axes this can add padding on the wrong side and clip a label that fits the canvas. Very large finite linear ranges can also overflow that midpoint calculation.
Use normalized coordinate 0.5 for both centered label glyph boxes. Tests compare bounds with the position requested by axis drawing and exercise horizontal and vertical label containment through
Plot.Draw.Validation: the root package and all non-plotter packages pass race tests on Go 1.25 and 1.26. Configured copyright, formatting, imports, Staticcheck 2025.1, and vet checks pass. Plotter image comparisons fail on this macOS host; matching base runs reproduce the same failures, and the seven affected image outputs are byte-identical before and after the patch. Tests use
-trimpathfor the recorder's expected source paths.Prepared with AI assistance.