diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 9ce3c80edd3f..941234fe06bb 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -933,7 +933,7 @@ def get_cursor_data(self, event): return arr[i, j] def format_cursor_data(self, data): - if self.colorbar: + if np.ndim(data) == 0 and self.colorbar: return ( "[" + cbook.strip_math(