From f9fe06bb2fc91e13a796a1712504e1d12ae1d4b2 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 2 May 2022 17:24:27 -0400 Subject: [PATCH] Backport PR #22957: fix "is" comparison for np.array --- lib/matplotlib/collections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index a072e22a73fb..28cbcca973d6 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -2214,6 +2214,9 @@ def get_cursor_data(self, event): if len(info["ind"]) == 1: ind, = info["ind"] array = self.get_array() - return array[ind] if array else None + if array is not None: + return array[ind] + else: + return None else: return None