Skip to content

Norms need scales for good colorbars... #16375

Closed

Description

@jklymak

Right now some color norms have accompanying scales, which allows their colorbars to have first-class scales. But some do not...

  • LogNorm: log
  • PowerNorm: no scale
  • TwoSlopeNorm: no scale
  • BoundaryNorm: shouldn't have a scale

Instead of inferring the first-class scale, I'd suggest we add a new property: norm._scale so that colorbar does not have to guess the scale. This should be a string so that it will only call registered scales, and it should be None when no scale is defined.

If its None, then colorbar will use the old default way of setting the scale. Otherwise it will set the scale using ax.set_yscale(norm._scale).

We probably don't want the user to set this - if they want to change the colorbar scale, they can simply use the normal ax.set_yscale directly.

Activity

  1. added this to the v3.3.0 milestone on Jan 30, 2020
  2. anntzer commented on Jan 30, 2020

    @anntzer
    Contributor

    I have a patch at https://github.com/anntzer/matplotlib/tree/_wip/scale-norm that provides a _make_norm_from_scale factory that converts Scales to Norms with that intent. I haven't PR'd it yet both because it's still incomplete and because it goes on top of the yet-to-be-merged #14916 :)

  3. jklymak commented on Jan 31, 2020

    @jklymak
    MemberAuthor

    @anntzer Overall #14916 looks right to me, but I hvanet reviewed carefully yet. Please ping me if I don't by the end of the w/e?

  4. modified the milestones: v3.3.0, v3.4.0 on May 23, 2020
  5. modified the milestones: v3.4.0, v3.5.0 on Jan 27, 2021
  6. modified the milestones: v3.5.0, v3.6.0 on Sep 25, 2021
  7. modified the milestones: v3.6.0, v3.7.0 on Jul 8, 2022
  8. github-actions commented on Mar 30, 2026

    @github-actions

    This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

  9. anntzer commented on Mar 30, 2026

    @anntzer
    Contributor

    Done in #16457 and followup PRs.

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