diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 03b651edafb8..73fd7e827f7e 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -930,7 +930,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(