Skip to content

[FIX]: colorbar "boundary" kwarg should be deprecated... #21914

@jklymak

Description

Problem

We broke this in 3.5.0, but in 3.4.3

import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl

fig, ax = plt.subplots()
pc = ax.imshow(np.random.randn(10, 10), cmap='RdBu_r')
cb = fig.colorbar(pc, ax=ax, boundaries=np.linspace(-4, 4, 5))
plt.show()

would do:

cbarissue

I'm not a fan of us enabling digitizing the colorbar differently than the data. If someone wants boundaries, they should be doing them with a BoundaryNorm:

fig, ax = plt.subplots()
norm = mpl.colors.BoundaryNorm(np.linspace(-4, 4, 5), 256)
pc = ax.imshow(X, cmap='RdBu_r', norm=norm)
cb = fig.colorbar(pc, ax=ax)

cbarissue2

Proposed solution

deprecate the boundaries kwarg....

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions