diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 5f50fbd5db28..f65ab4ef89f7 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3505,7 +3505,7 @@ def apply_mask(arrays, mask): return [array[mask] for array in arrays] f"'{dep_axis}err' (shape: {np.shape(err)}) must be a " f"scalar or a 1D or (2, n) array-like whose shape matches " f"'{dep_axis}' (shape: {np.shape(dep)})") from None - res = np.zeros_like(err, dtype=bool) # Default in case of nan + res = np.zeros(err.shape, dtype=bool) # Default in case of nan if np.any(np.less(err, -err, out=res, where=(err == err))): # like err<0, but also works for timedelta and nan. raise ValueError(