def subplot(*args, **kwargs):
fig = gcf()<EOL>a = fig.add_subplot(*args, **kwargs)<EOL>bbox = a.bbox<EOL>byebye = []<EOL>for other in fig.axes:<EOL><INDENT>if other==a: continue<EOL>if bbox.fully_overlaps(other.bbox):<EOL><INDENT>byebye.append(other)<EOL><DEDENT><DEDENT>for ax in byebye: delaxes(ax)<EOL>draw_if_interactive()<EOL>return a<EOL>
Create a subplot command, creating axes with::

  subplot(numRows, numCols, plotNum)

where *plotNum* = 1 is the first plot number and increasing *plotNums*
fill rows first.  max(*plotNum*) == *numRows* * *numCols*

You can leave out the commas if *numRows* <= *numCols* <=
*plotNum* < 10, as in::

  subplot(211)    # 2 rows, 1 column, first (upper) plot

``subplot(111)`` is the default axis.

New subplots that overlap old will delete the old axes.  If you do
not want this behavior, use
:meth:`matplotlib.figure.Figure.add_subplot` or the
:func:`~matplotlib.pyplot.axes` command.  Eg.::

  from pylab import *
  plot([1,2,3])  # implicitly creates subplot(111)
  subplot(211)   # overlaps, subplot(111) is killed
  plot(rand(12), rand(12))
  subplot(212, axisbg='y') # creates 2nd subplot with yellow background

Keyword arguments:

  *axisbg*:
    The background color of the subplot, which can be any valid
    color specifier.  See :mod:`matplotlib.colors` for more
    information.

  *polar*:
    A boolean flag indicating whether the subplot plot should be
    a polar projection.  Defaults to False.

  *projection*:
    A string giving the name of a custom projection to be used
    for the subplot. This projection must have been previously
    registered. See :func:`matplotlib.projections.register_projection`

.. seealso::
    :func:`~matplotlib.pyplot.axes`:
        For additional information on :func:`axes` and
        :func:`subplot` keyword arguments.

    :file:`examples/pylab_examples/polar_scatter.py`

**Example:**

.. plot:: mpl_examples/pylab_examples/subplot_demo.py