# matplotlib.gridspec¶

gridspec contains classes that help to layout multiple Axes in a grid-like pattern within a figure.

The GridSpec specifies the overall grid structure. Individual cells within the grid are referenced by SubplotSpecs.

See the tutorial Customizing Figure Layouts Using GridSpec and Other Functions for a comprehensive usage guide.

## Classes¶

 GridSpec(nrows, ncols[, figure, left, ...]) Specifies the geometry of the grid that a subplot can be placed in. SubplotSpec(gridspec, num1[, num2]) Specifies the location of a subplot in a GridSpec. GridSpecBase(nrows, ncols[, height_ratios, ...]) A base class of GridSpec that specifies the geometry of the grid that a subplot will be placed. GridSpecFromSubplotSpec(nrows, ncols, ...[, ...]) GridSpec whose subplot layout parameters are inherited from the location specified by a given SubplotSpec.