@@ -711,32 +711,47 @@ def gca(**kwargs):
711
711
712
712
def subplot (* args , ** kwargs ):
713
713
"""
714
- Create a new axes (subplot) .
714
+ Return a subplot axes positioned by the given grid definition .
715
715
716
- Creating axes with ::
716
+ Typical call signature ::
717
717
718
- subplot(numRows, numCols, plotNum )
718
+ subplot(nrows, ncols, plot_number )
719
719
720
- where *plotNum* = 1 is the first plot number and increasing *plotNums*
721
- fill rows first. max(*plotNum*) == *numRows* * *numCols*
720
+ Where *nrows* and *ncols* are used to notionally split the figure
721
+ into ``nrows * ncols`` sub-axes, and *plot_number* is used to identify
722
+ the particular subplot that this function is to create within the notional
723
+ grid. *plot_number* starts at 1, increments across rows first and has a
724
+ maximum of ``nrows * ncols``.
722
725
723
- You can leave out the commas if *numRows* <= *numCols* <=
724
- *plotNum* < 10, as in::
726
+ In the case when *nrows*, *ncols* and *plot_number* are all less than 10,
727
+ a convenience exists, such that the a 3 digit number can be given instead,
728
+ where the hundreds represent *nrows*, the tens represent *ncols* and the
729
+ units represent *plot_number*. For instance::
725
730
726
- subplot(211) # 2 rows, 1 column, first (upper) plot
731
+ subplot(211)
727
732
728
- ``subplot(111)`` is the default axis.
733
+ produces a subaxes in a figure which represents the top plot (i.e. the
734
+ first) in a 2 row by 1 column notional grid (no grid actually exists,
735
+ but conceptually this is how the returned subplot has been positioned).
729
736
730
- New subplots that overlap old will delete the old axes. If you do
731
- not want this behavior, use
732
- :meth:`~matplotlib.figure.Figure.add_subplot` or the
733
- :func:`~matplotlib.pyplot.axes` command. Eg.::
737
+ .. note::
734
738
735
- from pylab import *
736
- plot([1,2,3]) # implicitly creates subplot(111)
737
- subplot(211) # overlaps, subplot(111) is killed
738
- plot(rand(12), rand(12))
739
- subplot(212, axisbg='y') # creates 2nd subplot with yellow background
739
+ Creating a new subplot with a position which is entirely inside a
740
+ pre-existing axes will trigger the larger axes to be deleted::
741
+
742
+ import matplotlib.pyplot as plt
743
+ # plot a line, implicitly creating a subplot(111)
744
+ plt.plot([1,2,3])
745
+ # now create a subplot which represents the top plot of a grid
746
+ # with 2 rows and 1 column. Since this subplot will overlap the
747
+ # first, the plot (and its axes) previously created, will be removed
748
+ plt.subplot(211)
749
+ plt.plot(range(12))
750
+ plt.subplot(212, axisbg='y') # creates 2nd subplot with yellow background
751
+
752
+ If you do not want this behavior, use the
753
+ :meth:`~matplotlib.figure.Figure.add_subplot` method or the
754
+ :func:`~matplotlib.pyplot.axes` function instead.
740
755
741
756
Keyword arguments:
742
757
@@ -2997,7 +3012,7 @@ def stackplot(x, *args, **kwargs):
2997
3012
draw_if_interactive ()
2998
3013
finally :
2999
3014
ax .hold (washold )
3000
-
3015
+
3001
3016
return ret
3002
3017
3003
3018
# This function was autogenerated by boilerplate.py. Do not edit as
0 commit comments