Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a78947

Browse files
committed
Slim down line count (and fix typo) in figure.legend
1 parent 35a74eb commit 8a78947

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/matplotlib/figure.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,37 +1418,31 @@ def legend(self, *args, **kwargs):
14181418
labels = []
14191419

14201420
def in_handles(h, l):
1421-
'''
1422-
Method to check if we already have a given handle and label.
1421+
# Method to check if we already have a given handle and label.
1422+
# Consider two handles to be the same if they share a label,
1423+
# color, facecolor, and edgecolor.
14231424

1424-
We consdier two handles to be the same if they share a label,
1425-
color, facecolor, and edgecolor.
1426-
'''
14271425
# Loop through each handle and label already collected
14281426
for f_h, f_l in zip(handles, labels):
14291427
if f_l != l:
14301428
continue
14311429
if type(f_h) != type(h):
14321430
continue
1433-
14341431
try:
14351432
if f_h.get_color() != h.get_color():
14361433
continue
14371434
except AttributeError:
14381435
pass
1439-
14401436
try:
14411437
if f_h.get_facecolor() != h.get_facecolor():
14421438
continue
14431439
except AttributeError:
14441440
pass
1445-
14461441
try:
14471442
if f_h.get_edgecolor() != h.get_edgecolor():
14481443
continue
14491444
except AttributeError:
14501445
pass
1451-
14521446
return True
14531447
return False
14541448

0 commit comments

Comments
 (0)