Skip to content

Support passing xticks/yticks when constructing secondary_axis. #30367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 29, 2025

Previously, passing xticks to a secondary_xaxis call, or similarly yticks to secondary_yaxis (see added test), would get silently ignored, because the set ticks would get overwritten in _set_scale (called by set_functions). Fix that by toggling the secax._ticks_set private flag, which already exists for that purpose in set_ticks.

While at it, also simplify the implementation of set_ticks by relying on functools.wraps to copy the relevant signature.

PR summary

PR checklist

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this error out of the user tries to set the wrong ticks? There is only one visible axis.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 29, 2025

Shouldnt this error out of the user tries to set the wrong ticks? There is only one visible axis.

Sure, done.

Previously, passing xticks to a secondary_xaxis call, or similarly
yticks to secondary_yaxis (see added test), would get silently ignored,
because the set ticks would get overwritten in _set_scale (called by
set_functions).  Fix that by toggling the secax._ticks_set private flag,
which already exists for that purpose in set_ticks.

While at it, also simplify the implementation of set_ticks by relying on
functools.wraps to copy the relevant signature.
@QuLogic QuLogic merged commit 1c3c32f into matplotlib:main Jul 31, 2025
40 checks passed
@QuLogic QuLogic added this to the v3.11.0 milestone Jul 31, 2025
@anntzer anntzer deleted the st branch July 31, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy