Загрузка
GridSpecThe GridSpec, which the subplot is referencing.
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.
The columns spanned by this subplot, as a range object.
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 cell
start == stop).
Update the subplot position from figure.subplotpars.
Return the topmost SubplotSpec instance associated with the subplot.
The rows spanned by this subplot, as a range object.
Create a GridSpec within this subplot.
The created GridSpecFromSubplotSpec will have this SubplotSpec as
a parent.
Number of rows in grid.
Number of columns in grid.
All other parameters are passed to GridSpecFromSubplotSpec.
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])
matplotlib.gridspec.SubplotSpec