Skip to content

Commit 64e3a86

Browse files
lukashergttimhoffm
andauthored
Apply suggestions from code review
Using helper for `'none'` string equality and using the fact that `to_rgba` always returns a 4-element tuple to simplify the code. Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent db46a5c commit 64e3a86

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/matplotlib/legend.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,9 @@ def __init__(
609609
text.set_color(color[0])
610610
else:
611611
pass
612-
elif isinstance(color, str) and str(color).lower() == 'none':
612+
elif cbook._str_lower_equal(color, 'none'):
613613
continue
614-
elif (len(mpl.colors.to_rgba(color)) == 4
615-
and mpl.colors.to_rgba(color)[3] == 0):
614+
elif mpl.colors.to_rgba(color)[3] == 0:
616615
continue
617616
else:
618617
text.set_color(color)

0 commit comments

Comments
 (0)