Skip to content

Commit d9e489e

Browse files
committed
Consistent return types when using indicate_error (fixes #260)
1 parent edc5cf8 commit d9e489e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

proplot/axes/plot.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,7 @@ def indicate_error(
16161616

16171617
# Apply inferrred colors to objects
16181618
i = 0
1619-
if isinstance(res, (list, tuple)): # avoid BarContainer
1619+
if isinstance(res, tuple): # pull out patch from e.g. BarContainers
16201620
obj = res[0]
16211621
for b, infer in zip((fade, shade), (fadecolor_infer, shadecolor_infer)):
16221622
if not b or not infer:
@@ -1632,12 +1632,14 @@ def indicate_error(
16321632
i += 1
16331633

16341634
# Return objects
1635-
# NOTE: This should not affect internal matplotlib calls to these funcs
1635+
# NOTE: For now 'errobjs' can only be returned with 1D y coordinates
16361636
# NOTE: Avoid expanding matplolib collections that are list subclasses here
1637-
if eobjs:
1638-
return (*res, *eobjs) if isinstance(res, (list, tuple)) else (res, *eobjs)
1639-
else:
1637+
if not eobjs:
16401638
return res
1639+
elif isinstance(res, tuple) and not isinstance(res, mcontainer.Container):
1640+
return ((*res, *eobjs),) # for plot()
1641+
else:
1642+
return (res, *eobjs)
16411643

16421644

16431645
def _apply_plot(self, *args, cmap=None, values=None, **kwargs):

0 commit comments

Comments
 (0)