You are reading an old version of the documentation (v3.1.1). For the latest version see
Version 3.1.2
Fork me on GitHub


class mpl_toolkits.axes_grid1.axes_grid.ImageGrid(fig, rect, nrows_ncols, ngrids=None, direction='row', axes_pad=0.02, add_all=True, share_all=False, aspect=True, label_mode='L', cbar_mode=None, cbar_location='right', cbar_pad=None, cbar_size='5%', cbar_set_cax=True, axes_class=None)[source]

Bases: mpl_toolkits.axes_grid1.axes_grid.Grid

A class that creates a grid of Axes. In matplotlib, the axes location (and size) is specified in the normalized figure coordinates. This may not be ideal for images that needs to be displayed with a given aspect ratio. For example, displaying images of a same size with some fixed padding between them cannot be easily done in matplotlib. ImageGrid is used in such case.

fig : Figure

The parent figure.

rect : (float, float, float, float) or int

The axes position, as a (left, bottom, width, height) tuple or as a three-digit subplot position code (e.g., "121").

direction : {"row", "column"}, default: "row"
axes_pad : float or (float, float), default: 0.02

Padding or (horizontal padding, vertical padding) between axes, in inches.

add_all : bool, default: True
share_all : bool, default: False
aspect : bool, default: True
label_mode : {"L", "1", "all"}, default: "L"

Determines which axes will get tick labels:

  • "L": All axes on the left column get vertical tick labels; all axes on the bottom row get horizontal tick labels.
  • "1": Only the bottom left axes is labelled.
  • "all": all axes are labelled.
cbar_mode : {"each", "single", "edge", None }, default: None
cbar_location : {"left", "right", "bottom", "top"}, default: "right"
cbar_pad : float, default: None
cbar_size : size specification (see Size.from_any), default: "5%"
cbar_set_cax : bool, default: True

If True, each axes in the grid has a cax attribute that is bound to associated cbar_axes.

axes_class : a type that is a subclass of matplotlib.axes.Axes, default: None