You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1695+gedd053d16
Fork me on GitHub


class matplotlib.gridspec.SubplotSpec(gridspec, num1, num2=None)[source]

Specifies the location of the subplot in the given GridSpec.

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.

The index starts from 0.


Get the subplot geometry (n_rows, n_cols, start, stop).

start and stop are the index of the start and stop of the subplot.

get_position(figure, return_all=False)[source]

Update the subplot position from figure.subplotpars.


Get the subplot row and column numbers: (n_rows, n_cols, row_start, row_stop, col_start, col_stop)


get the topmost SubplotSpec instance associated with the subplot