Skip to content

New colorbar doesn't handle norms without a scale properly... #20324

Closed
@jklymak

Description

@jklymak

As reported at astropy by @dstansby: (astropy/astropy#11800) colorbars with norms that do not have a scale associated with them are not being ticked properly.

import matplotlib.pyplot as plt 
import numpy as np
import matplotlib.colors as mcolors

fig, ax = plt.subplots()

pc = ax.imshow(np.arange(100).reshape(10, 10), norm=mcolors.TwoSlopeNorm(20, 0, 100), cmap='RdBu_r')

cb = fig.colorbar(pc, extend='both')
plt.show()

3.4.2 (correct)

olddd

Master (incorrect)

newww

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions