matplotlib 3.5.1

Other ParametersParametersReturns
add_gridspec(self, nrows=1, ncols=1, **kwargs)

Other Parameters

**kwargs :

Keyword arguments are passed to .GridSpec .

Parameters

nrows : int, default: 1

Number of rows in grid.

ncols : int, default: 1

Number or columns in grid.

Returns

`.GridSpec`

Return a .GridSpec that has this figure as a parent. This allows complex layout of Axes in the figure.

See Also

matplotlib.pyplot.subplots

Examples

fig = plt.figure() gs = fig.add_gridspec(2, 2) ax1 = fig.add_subplot(gs[0, 0]) ax2 = fig.add_subplot(gs[1, 0]) # spans two rows: ax3 = fig.add_subplot(gs[:, 1])

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/figure.py#1355
type: <class 'function'>
Commit: