| 1 | diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py |
| 2 | --- a/lib/matplotlib/colorbar.py |
| 3 | +++ b/lib/matplotlib/colorbar.py |
| 4 | @@ -301,11 +301,6 @@ def __init__(self, ax, mappable=None, *, cmap=None, |
| 5 | if mappable is None: |
| 6 | mappable = cm.ScalarMappable(norm=norm, cmap=cmap) |
| 7 | |
| 8 | - # Ensure the given mappable's norm has appropriate vmin and vmax |
| 9 | - # set even if mappable.draw has not yet been called. |
| 10 | - if mappable.get_array() is not None: |
| 11 | - mappable.autoscale_None() |
| 12 | - |
| 13 | self.mappable = mappable |
| 14 | cmap = mappable.cmap |
| 15 | norm = mappable.norm |
| 16 | @@ -1101,7 +1096,10 @@ def _process_values(self): |
| 17 | b = np.hstack((b, b[-1] + 1)) |
| 18 | |
| 19 | # transform from 0-1 to vmin-vmax: |
| 20 | + if self.mappable.get_array() is not None: |
| 21 | + self.mappable.autoscale_None() |
| 22 | if not self.norm.scaled(): |
| 23 | + # If we still aren't scaled after autoscaling, use 0, 1 as default |
| 24 | self.norm.vmin = 0 |
| 25 | self.norm.vmax = 1 |
| 26 | self.norm.vmin, self.norm.vmax = mtransforms.nonsingular( |