diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index a485fdefc584..34f529ecb044 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -901,6 +901,10 @@ def add_subplot(self, *args, **kwargs): if len(args) == 1 and isinstance(args[0], int): args = tuple([int(c) for c in str(args[0])]) + if len(args) != 3: + raise ValueError("Integer subplot specification must " + + "be a three digit number. " + + "Not {n:d}".format(n=len(args))) if isinstance(args[0], SubplotBase):