Skip to content

Commit 0efe198

Browse files
committed
Improve error message for gridspec
1 parent aa1c538 commit 0efe198

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/gridspec.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,10 @@ def _from_subplot_args(figure, args):
599599
)
600600
i, j = num
601601
else:
602-
if not isinstance(num, Integral) or num < 1 or num > rows*cols:
602+
if not isinstance(num, Integral):
603+
raise ValueError(
604+
f"Subplot specifier must be an integer, not {num!r}")
605+
if num < 1 or num > rows*cols:
603606
raise ValueError(
604607
f"num must be 1 <= num <= {rows*cols}, not {num!r}")
605608
i = j = num

0 commit comments

Comments
 (0)