Skip to content

Commit 016ed87

Browse files
committed
Clearer error message for plt.axis()
1 parent ec1693c commit 016ed87

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,11 +1660,15 @@ def axis(self, *args, emit=True, **kwargs):
16601660
"3.2", message="Passing more than one positional "
16611661
"argument to axis() is deprecated and will raise a "
16621662
"TypeError %(removal)s.")
1663-
v = args[0]
1663+
limits = args[0]
16641664
try:
1665-
xmin, xmax, ymin, ymax = v
1665+
xmin, xmax, ymin, ymax = limits
16661666
except ValueError:
16671667
raise ValueError('args must contain [xmin xmax ymin ymax]')
1668+
except TypeError:
1669+
raise TypeError('the first argument to axis() must be an '
1670+
'interable of the form '
1671+
'[xmin, xmax, ymin, ymax]')
16681672
else:
16691673
xmin = kwargs.pop('xmin', None)
16701674
xmax = kwargs.pop('xmax', None)

0 commit comments

Comments
 (0)