Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 118d2e4

Browse files
authored
Merge pull request #9749 from matplotlib/auto-backport-of-pr-9748
Backport PR #9748 on branch v2.1.x
2 parents c699513 + ee55b94 commit 118d2e4

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

lib/matplotlib/pyplot.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -964,28 +964,22 @@ def gca(**kwargs):
964964

965965
def subplot(*args, **kwargs):
966966
"""
967-
Return a subplot axes positioned by the given grid definition.
967+
Return a subplot axes at the given grid position.
968968
969-
Typical call signature::
969+
Call signature::
970970
971-
subplot(nrows, ncols, plot_number)
971+
subplot(nrows, ncols, index, **kwargs)
972972
973-
Where *nrows* and *ncols* are used to notionally split the figure
974-
into ``nrows * ncols`` sub-axes, and *plot_number* is used to identify
975-
the particular subplot that this function is to create within the notional
976-
grid. *plot_number* starts at 1, increments across rows first and has a
977-
maximum of ``nrows * ncols``.
973+
In the current figure, create and return an `~.Axes`, at position *index*
974+
of a (virtual) grid of *nrows* by *ncols* axes. Indexes go from 1 to
975+
``nrows * ncols``, incrementing in row-major order.
978976
979-
In the case when *nrows*, *ncols* and *plot_number* are all less than 10,
980-
a convenience exists, such that the a 3 digit number can be given instead,
981-
where the hundreds represent *nrows*, the tens represent *ncols* and the
982-
units represent *plot_number*. For instance::
977+
If *nrows*, *ncols* and *index* are all less than 10, they can also be
978+
given as a single, concatenated, three-digit number.
983979
984-
subplot(211)
985-
986-
produces a subaxes in a figure which represents the top plot (i.e. the
987-
first) in a 2 row by 1 column notional grid (no grid actually exists,
988-
but conceptually this is how the returned subplot has been positioned).
980+
For example, ``subplot(2, 3, 3)`` and ``subplot(233)`` both create an
981+
`~.Axes` at the top right corner of the current figure, occupying half of
982+
the figure height and a third of the figure width.
989983
990984
.. note::
991985

0 commit comments

Comments
 (0)