Closed
Description
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")
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:
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)