# mpl_toolkits.axes_grid1.axes_grid.Grid¶

class mpl_toolkits.axes_grid1.axes_grid.Grid(fig, rect, nrows_ncols, ngrids=None, direction='row', axes_pad=0.02, add_all=True, share_all=False, share_x=True, share_y=True, label_mode='L', axes_class=None)[source]

Bases: object

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. AxesGrid is used in such case.

Build an Grid instance with a grid nrows*ncols Axes in Figure fig with rect=[left, bottom, width, height] (in Figure coordinates) or the subplot position code (e.g., "121").

Optional keyword arguments:

Keyword Default Description
direction "row" [ "row" | "column" ]
share_all False bool
share_x True bool
share_y True bool
label_mode "L" [ "L" | "1" | "all" ]
axes_class None a type object which must be a subclass of Axes
get_aspect()[source]

get aspect

get_axes_locator()[source]
get_axes_pad()[source]

get_divider()[source]
get_geometry()[source]

get geometry of the grid. Returns a tuple of two integer, representing number of rows and number of columns.

get_vsize_hsize()[source]
set_aspect(aspect)[source]

set aspect

set_axes_locator(locator)[source]
set_axes_pad(axes_pad)[source]

set_label_mode(mode)[source]