Skip to content

Commit da53a8d

Browse files
committed
Improve _iter_legend_objects algorithm
1 parent 4e726ef commit da53a8d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proplot/axes/plot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,13 +2192,13 @@ def _iter_legend_objects(objs):
21922192
# Account for (1) multiple columns of data, (2) functions that return
21932193
# multiple values (e.g. hist() returns (bins, values, patches)), and
21942194
# (3) matplotlib.Collection list subclasses.
2195-
if isinstance(objs, (list, tuple)):
2196-
for obj in objs:
2197-
yield from _iter_legend_objects(obj)
2198-
elif hasattr(objs, 'get_label'):
2195+
if hasattr(objs, 'get_label'):
21992196
label = objs.get_label()
22002197
if label and label[:1] != '_':
22012198
yield (objs, label)
2199+
elif isinstance(objs, (list, tuple)):
2200+
for obj in objs:
2201+
yield from _iter_legend_objects(obj)
22022202

22032203

22042204
def cycle_changer(

0 commit comments

Comments
 (0)