Skip to content

[MNT]: Remove axis parameter from scales #29349

Closed

Description

@timhoffm

Summary

For historic reasons, Scales take the axis as the first parameter. It's use is discouraged and none of our own scales actually use it at least since #12831.

To simplify our code, we should get rid of that parameter.

Proposed fix

Do we know whether

  • downstream libraries add their own Scales via register_scale()?
  • user will directly instantiate our own Scale classes?

If so we need the full deprecation machinery:

  1. Make scale_factory work with scales have or have not an initial axis parameter. Either by try-except with/without this parameter or by introspecting the signature.
  2. Introspect scale classes passed to register_scale and warn if they still have the axis argument.
  3. Make all our scales work with/without the axis parameter by adding a suitable decorator to their init functions. - Refactoring: Removing axis parameter from scales #29988
    Otherwise, we can simplify the transition.

--

Edit: Both questions are yes, so we need the full deprecation mechanism.

Activity

  1. anntzer commented on Jan 7, 2025

    @anntzer
    Contributor

    Downstream libraries: there's at least https://github.com/matplotlib/mpl-probscale.

  2. timhoffm commented on Jan 7, 2025

    @timhoffm
    MemberAuthor

    Yes, and some other usage, which means we'll take it slow through the full deprecation machinery, including a pending deprecation.

  3. timhoffm commented on Aug 24, 2025

    @timhoffm
    MemberAuthor

    This is complete for now, i.e. everything we can do right now for the removal is done.

    Migration timeline:

    • 3.11: Builtin scales, can be called with and without the axis parameter. register_scale() works for both, scales with and without an axis parameter. If an axis parameter is found, a pending deprecation warning is issued.
    • 3.13: The pending deprecation will be changed to a full deprecation.
    • 3.15: register_scale will raise an error if a scale with an axis parameter is found. The axis parameter is removed from builtin scales.
    • (optionally) 3.17 or later: Remove the introspection for an axis parameter from register_scale again. This would mean that register_scale will not catch the old scale signature. Instead it will raise later at usage of the scale. This would simplify registration code at the expense of more obscure error messages at runtime (but they typically should not happen anymore as their use has been deprecated for a reasonably long time).
  4. added this to the v3.11.0 milestone on Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions