diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 05b78b42cf62..a072e22a73fb 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -2213,6 +2213,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