Closed
Description
Problem description
A simple plot is empty under the following cirumstances:
Use the standard example:
import matplotlib.pyplot as plt
from matplotlib.colors import CenteredNorm
import numpy as np
data = np.random.random((100, 100))
fig, ax = plt.subplots()
im = ax.imshow(data, norm=CenteredNorm(halfrange=0.2))
fig.colorbar(im)
plt.show(block=True)
If you now delete the line fig.colorbar(im)
, the data is not shown (white content). If you then remove halfrange=0.2
the data appears again. This is unexpected as one needs to see the data even by giving a certain halfrange and without the colorbar.
Standard (expected) outcome
Outcome without colorbar line
System
Microsoft Windows [Version 10.0.25300.1000]
VS Code 1.76.2
Python 3.10.8
Tested as python script and Jupyter notebook
@jpmattern