GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • matplotlib
  • matplotlib.animation
  • matplotlib.animation.Animation
  • matplotlib.animation.FuncAnimation

This view

  • Original page
  • New address

GeezerVison is showing matplotlib.org — matplotlib.pyplot.subplot2grid — Matplotlib 3.11.2 documentation

matplotlib.pyplot.subplot2grid#

matplotlib.pyplot.subplot2grid(shape, loc, rowspan=1, colspan=1, fig=None, **kwargs)[source]#

Create a subplot at a specific location inside a regular grid.

Parameters:
shape(int, int)

Number of rows and of columns of the grid in which to place axis.

loc(int, int)

Row number and column number of the axis location within the grid.

rowspanint, default: 1

Number of rows for the axis to span downwards.

colspanint, default: 1

Number of columns for the axis to span to the right.

figFigure, optional

Figure to place the subplot in. Defaults to the current figure.

**kwargs

Additional keyword arguments are handed to add_subplot.

Returns:
Axes

The Axes of the subplot. The returned Axes can actually be an instance of a subclass, such as projections.polar.PolarAxes for polar projections.

Notes

The following call

ax = subplot2grid((nrows, ncols), (row, col), rowspan, colspan)

is identical to

fig = gcf()
gs = fig.add_gridspec(nrows, ncols)
ax = fig.add_subplot(gs[row:row+rowspan, col:col+colspan])

Examples using matplotlib.pyplot.subplot2grid#

subplot2grid

subplot2grid

Resize Axes with tight layout

Resize Axes with tight layout

Arranging multiple Axes in a Figure

Arranging multiple Axes in a Figure

Constrained layout guide

Constrained layout guide

Tight layout guide

Tight layout guide
On this page
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.