Skip to content

Fix minor ticks being dropped when tick values are set explicitly#20018

Open
oldrobotdev wants to merge 2 commits into
astropy:mainfrom
oldrobotdev:wcsaxes-minor-ticks-explicit-values
Open

Fix minor ticks being dropped when tick values are set explicitly#20018
oldrobotdev wants to merge 2 commits into
astropy:mainfrom
oldrobotdev:wcsaxes-minor-ticks-explicit-values

Conversation

@oldrobotdev

Copy link
Copy Markdown

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.

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.
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
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.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@pllim pllim added this to the v8.1.0 milestone Jul 2, 2026
@pllim pllim added the Bug label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use set_ticks(values=) will override display_minor_ticks(True)

2 participants