Thanks to visit codestin.com
Credit goes to github.com

Skip to content

colorbar(boundaries=...) doesn't work so well with nonlinear norms #12312

Closed
@anntzer

Description

@anntzer

Bug report

Bug summary

Code for reproduction

from pylab import *
imshow(np.random.rand(100, 100), norm=mpl.colors.LogNorm())
colorbar(boundaries=[1e-4, 1e-3, 1e-2, 1])

Actual outcome

test

Expected outcome

Either properly positioned boundaries, or (better) disallow passing boundaries in such cases.

Note that the docstrings in colorbar.py say

    The following will probably be useful only in the context of
    indexed colors (that is, when the mappable has norm=NoNorm()),
    or other unusual circumstances.

    ============   ===================================================
    Property       Description
    ============   ===================================================
    *boundaries*   None or a sequence
    *values*       None or a sequence which must be of length 1 less
                   than the sequence of *boundaries*. For each region
                   delimited by adjacent entries in *boundaries*, the
                   color mapped to the corresponding value in values
                   will be used.
    ============   ===================================================

but that still ends up part of the public API, which makes my intended fix for #7320 more difficult...

Matplotlib version

  • Operating system: linux
  • Matplotlib version: master
  • Matplotlib backend (print(matplotlib.get_backend())): qt5agg
  • Python version: 3.7
  • Jupyter version (if applicable):
  • Other libraries:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions