'*fig* is a :class:`matplotlib.figure.Figure` instance.
*args* is the tuple (*numRows*, *numCols*, *plotNum*), where
the array of subplots in the figure has dimensions *numRows*,
*numCols*, and where *plotNum* is the number of the subplot
being created.  *plotNum* starts at 1 in the upper left
corner and increases to the right.
If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the
decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*.'

def __init__(self, fig, *args, **kwargs):

    self.figure = fig
    if (len(args) == 1):
        if isinstance(args[0], SubplotSpec):
            self._subplotspec = args[0]
        else:
            try:
                s = str(int(args[0]))
                (rows, cols, num) = map(int, s)
            except ValueError:
                raise ValueError(u'Single    argument    to    subplot    must    be    a    3-digit    integer')
            self._subplotspec = GridSpec(rows, cols)[(num - 1)]
    elif (len(args) == 3):
        (rows, cols, num) = args
        rows = int(rows)
        cols = int(cols)
        if (isinstance(num, tuple) and (len(num) == 2)):
            num = [int(n) for n in num]
            self._subplotspec = GridSpec(rows, cols)[(num[0] - 1):num[1]]
        else:
            if ((num < 1) or (num > (rows * cols))):
                raise ValueError(u'num    must    be    1    <=    num    <=    {maxn},    not    {num}'.format(maxn=(rows * cols), num=num))
            self._subplotspec = GridSpec(rows, cols)[(int(num) - 1)]
    else:
        raise ValueError((u'Illegal    argument(s)    to    subplot:    %s' % (args,)))
    self.update_params()
    self._axes_class.__init__(self, fig, self.figbox, **kwargs)
