Closed
Description
Bug report
Bug summary
The scatter
documentation says:
vmin and vmax are ignored if you pass a norm instance.
However, it seems that this is not the case. Is the documentation correct of the behaviour?
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
cmap = matplotlib.cm.viridis_r
norm = matplotlib.colors.BoundaryNorm([1,3,6,8], cmap.N, clip=True)
values = np.arange(10)
# only specifying a norm
plt.scatter(values, values, c=values, norm=norm)
# also specifying vmin/vmax. Should those be ignored?
plt.scatter(values, values, c=values, norm=norm, vmin=6, vmax=10)
Actual outcome
# only specifying a norm
plt.scatter(values, values, c=values, norm=norm)
# also specifying vmin/vmax. Should those be ignored?
plt.scatter(values, values, c=values, norm=norm, vmin=6, vmax=10)
So the vmin/vmax have clearly "altered" the BoundaryNorm applied on the data.
According to the documentation, this should not happen.
Specifically for a BoundaryNorm (with specified bounds), it seems strange let the plotting change those bounds.
Matplotlib version
- Operating system: Ubuntu 16.04
- Matplotlib version: 3.1.0
- Matplotlib backend (
print(matplotlib.get_backend())
): notebook inline backend - Python version: 3.7
- Installed from conda-forge