diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 5369eadbdefd..7e00a1edb73b 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -5718,6 +5718,18 @@ def imshow(self, X, cmap=None, norm=None, *, aspect=None, `~matplotlib.pyplot.imshow` expects RGB images adopting the straight (unassociated) alpha representation. """ + if not isinstance(vmax, (int, float)): + try: + vmax = vmax.to_tuple()[0] + except AttributeError: + raise AttributeError("vmax must be a scalar or a 1-element array") + + if not isinstance(vmin, (int, float)): + try: + vmin = vmin.to_tuple()[0] + except AttributeError: + raise AttributeError("vmin must be a scalar or a 1-element array") + if aspect is None: aspect = mpl.rcParams['image.aspect'] self.set_aspect(aspect)