Create a subplot at a specific location inside a regular grid.
Number of rows and of columns of the grid in which to place axis.
Row number and column number of the axis location within the grid.
Number of rows for the axis to span downwards.
Number of columns for the axis to span to the right.
Figure
, optional
Figure to place the subplot in. Defaults to the current figure.
Additional keyword arguments are handed to add_subplot
.
axes.SubplotBase
, or another subclass of Axes
The axes of the subplot. The returned axes base class depends on the projection used. It is Axes
if rectilinear projection is used and projections.polar.PolarAxes
if polar projection is used. The returned axes is then a subplot subclass of the base class.
The following call
ax = subplot2grid((nrows, ncols), (row, col), rowspan, colspan)
is identical to
fig = gcf() gs = fig.add_gridspec(nrows, ncols) ax = fig.add_subplot(gs[row:row+rowspan, col:col+colspan])
matplotlib.pyplot.subplot2grid
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.pyplot.subplot2grid.html