matplotlib.gridspec.SubplotSpec
- 
class matplotlib.gridspec.SubplotSpec(gridspec, num1, num2=None)[source] - 
Bases:
objectSpecifies the location of a subplot in a
GridSpec.Note
Likely, you'll never instantiate a
SubplotSpecyourself. Instead you will typically obtain one from aGridSpecusing item-access.Parameters: - 
gridspecGridSpec - 
The GridSpec, which the subplot is referencing.
 - 
num1, num2int - 
The subplot will occupy the num1-th cell of the given gridspec. If num2 is provided, the subplot will span between num1-th cell and num2-th cell inclusive.
The index starts from 0.
 
- 
property colspan - 
The columns spanned by this subplot, as a
rangeobject. 
- 
get_geometry(self)[source] - 
Return the subplot geometry as tuple
(n_rows, n_cols, start, stop).The indices start and stop define the range of the subplot within the
GridSpec. stop is inclusive (i.e. for a single cellstart == stop). 
- 
get_gridspec(self)[source] 
- 
get_position(self, figure, return_all=False)[source] - 
Update the subplot position from
figure.subplotpars. 
- 
get_rows_columns(self)[source] - 
Return the subplot row and column numbers as a tuple
(n_rows, n_cols, row_start, row_stop, col_start, col_stop). 
- 
get_topmost_subplotspec(self)[source] - 
Return the topmost
SubplotSpecinstance associated with the subplot. 
- 
property num2 
- 
property rowspan - 
The rows spanned by this subplot, as a
rangeobject. 
- 
subgridspec(self, nrows, ncols, **kwargs)[source] - 
Create a GridSpec within this subplot.
The created
GridSpecFromSubplotSpecwill have thisSubplotSpecas a parent.Parameters: - 
nrowsint - 
Number of rows in grid.
 - 
ncolsint - 
Number or columns in grid.
 
Returns: - 
gridspecGridSpecFromSubplotSpec 
Other Parameters: - **kwargs
 - 
All other parameters are passed to
GridSpecFromSubplotSpec. 
See also
Examples
Adding three subplots in the space occupied by a single subplot:
fig = plt.figure() gs0 = fig.add_gridspec(3, 1) ax1 = fig.add_subplot(gs0[0]) ax2 = fig.add_subplot(gs0[1]) gssub = gs0[2].subgridspec(1, 3) for i in range(3): fig.add_subplot(gssub[0, i]) - 
 
 - 
 
Examples using matplotlib.gridspec.SubplotSpec
 
    © 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
    https://matplotlib.org/3.2.2/api/_as_gen/matplotlib.gridspec.SubplotSpec.html