diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 49485bd90056..0aa37376a477 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -2201,6 +2201,7 @@ def get_cursor_data(self, event): contained, info = self.contains(event) if len(info["ind"]) == 1: ind, = info["ind"] - return self.get_array()[ind] + array = self.get_array() + return array[ind] if array else None else: return None