From 415cd6a314385ff8e1407bf9301312268168bfb2 Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Sun, 17 Dec 2017 14:07:03 +0300 Subject: [PATCH] Fix using .get_color() and friends in labels handling This code was introduced in v2.1.1 and, apparently, wasn't tested, because .get_color() returns array. Here is an issue example: https://github.com/sympy/sympy/issues/13730#issuecomment-351027060 --- lib/matplotlib/legend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 8c2aaa9b0c16..430aeb741897 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -1350,17 +1350,17 @@ def _in_handles(h, l): if type(f_h) != type(h): continue try: - if f_h.get_color() != h.get_color(): + if (f_h.get_color() != h.get_color()).any(): continue except AttributeError: pass try: - if f_h.get_facecolor() != h.get_facecolor(): + if (f_h.get_facecolor() != h.get_facecolor()).any(): continue except AttributeError: pass try: - if f_h.get_edgecolor() != h.get_edgecolor(): + if (f_h.get_edgecolor() != h.get_edgecolor()).any(): continue except AttributeError: pass