8000 Setting the norm on imshow object removes colorbar ylabel · Issue #17804 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Setting the norm on imshow object removes colorbar ylabel #17804
Closed
@nvaytet

Description

@nvaytet

Bug report

Bug summary

When using set_norm on an existing Image object created with imshow, the ylabel on the colorbar disappears.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize

fig, ax = plt.subplots(1, 1)
im = ax.imshow(np.random.random([10, 10]))
cb = plt.colorbar(im)
cb.ax.set_ylabel("Some values")

yields
Screenshot_2020-06-30_14-17-14

and then, after using set_norm

im.set_norm(Normalize(vmin=0.4, vmax=0.6))
fig

the colorbal label Some values on the right hand side has disappeared:
Screenshot_2020-06-30_14-18-11

Maybe a new colobar gets generated and the label gets lost in the process?

Matplotlib version

  • Operating system: Ubuntu 18.04
  • Matplotlib version: 3.2.1
  • Matplotlib backend (print(matplotlib.get_backend())): inline
  • Python version: 3.7
  • Jupyter version (if applicable):
  • Other libraries:

matplotlib installed via conda (conda-forge)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0