Fix minor ticks being dropped when tick values are set explicitly#20018
Open
oldrobotdev wants to merge 2 commits into
Open
Fix minor ticks being dropped when tick values are set explicitly#20018oldrobotdev wants to merge 2 commits into
oldrobotdev wants to merge 2 commits into
Conversation
WCSAxes minor_locator returned no minor ticks whenever the major tick values were given via set_ticks(values=...), even with display_minor_ticks(True) set, because the auto path derives minor positions from the major spacing and explicit values have none. Place minor ticks by subdividing the intervals between consecutive explicit values instead, which also handles unevenly spaced values.
Contributor
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
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.
Fixes #19529
Setting explicit tick values with set_ticks(values=...) dropped minor ticks entirely, even with display_minor_ticks(True): BaseFormatterLocator.minor_locator returns an empty list for the explicit-values case, because the auto path derives minor positions from the major spacing and explicit values have none. This subdivides the intervals between consecutive explicit values instead, placing frequency-1 minor ticks per interval, which also handles unevenly spaced values. A single value or a frequency of 1 still gives no minor ticks.
The previous behavior was pinned by test_minor_locator in both the Angle and Scalar variants (asserting an empty result for the values case), so those assertions are updated, plus a new test for the evenly spaced case from the issue. No image tests combine explicit values with minor ticks, so no reference images change.