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=<deprecated parameter>, share_all=False, share_x=True, share_y=True, label_mode='L', axes_class=None, *, aspect=False)[source]¶ Bases:
object
A grid of Axes.
In Matplotlib, the axes location (and size) is specified in normalized figure coordinates. This may not be ideal for images that needs to be displayed with a given aspect ratio; for example, it is difficult to display multiple images of a same size with some fixed padding between them. AxesGrid can be used in such case.
Parameters: - 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").- nrows_ncols(int, int)
Number of rows and columns in the grid.
- ngridsint or None, default: None
If not None, only the first ngrids axes in the grid are created.
- direction{"row", "column"}, default: "row"
Whether axes are created in row-major ("row by row") or column-major order ("column by column").
- axes_padfloat or (float, float), default: 0.02
Padding or (horizontal padding, vertical padding) between axes, in inches.
- add_allbool, default: True
Whether to add the axes to the figure using
Figure.add_axes
. This parameter is deprecated.- share_allbool, default: False
Whether all axes share their x- and y-axis. Overrides share_x and share_y.
- share_xbool, default: True
Whether all axes of a column share their x-axis.
- share_ybool, default: True
Whether all axes of a row share their y-axis.
- 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.
- axes_classsubclass of
matplotlib.axes.Axes
, default: None - aspectbool, default: False
Whether the axes aspect ratio follows the aspect ratio of the data limits.
-
__dict__
= mappingproxy({'__module__': 'mpl_toolkits.axes_grid1.axes_grid', '__doc__': '\n A grid of Axes.\n\n In Matplotlib, the axes location (and size) is specified in normalized\n figure coordinates. This may not be ideal for images that needs to be\n displayed with a given aspect ratio; for example, it is difficult to\n display multiple images of a same size with some fixed padding between\n them. AxesGrid can be used in such case.\n ', '_defaultAxesClass': <class 'mpl_toolkits.axes_grid1.mpl_axes.Axes'>, '__init__': <function Grid.__init__>, '_init_locators': <function Grid._init_locators>, '_get_col_row': <function Grid._get_col_row>, '__len__': <function Grid.__len__>, '__getitem__': <function Grid.__getitem__>, 'get_geometry': <function Grid.get_geometry>, 'set_axes_pad': <function Grid.set_axes_pad>, 'get_axes_pad': <function Grid.get_axes_pad>, 'set_aspect': <function Grid.set_aspect>, 'get_aspect': <function Grid.get_aspect>, 'set_label_mode': <function Grid.set_label_mode>, 'get_divider': <function Grid.get_divider>, 'set_axes_locator': <function Grid.set_axes_locator>, 'get_axes_locator': <function Grid.get_axes_locator>, 'get_vsize_hsize': <function Grid.get_vsize_hsize>, '__dict__': <attribute '__dict__' of 'Grid' objects>, '__weakref__': <attribute '__weakref__' of 'Grid' objects>})¶
-
__init__
(self, fig, rect, nrows_ncols, ngrids=None, direction='row', axes_pad=0.02, add_all=<deprecated parameter>, share_all=False, share_x=True, share_y=True, label_mode='L', axes_class=None, *, aspect=False)[source]¶ Parameters: - 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").- nrows_ncols(int, int)
Number of rows and columns in the grid.
- ngridsint or None, default: None
If not None, only the first ngrids axes in the grid are created.
- direction{"row", "column"}, default: "row"
Whether axes are created in row-major ("row by row") or column-major order ("column by column").
- axes_padfloat or (float, float), default: 0.02
Padding or (horizontal padding, vertical padding) between axes, in inches.
- add_allbool, default: True
Whether to add the axes to the figure using
Figure.add_axes
. This parameter is deprecated.- share_allbool, default: False
Whether all axes share their x- and y-axis. Overrides share_x and share_y.
- share_xbool, default: True
Whether all axes of a column share their x-axis.
- share_ybool, default: True
Whether all axes of a row share their y-axis.
- 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.
- axes_classsubclass of
matplotlib.axes.Axes
, default: None - aspectbool, default: False
Whether the axes aspect ratio follows the aspect ratio of the data limits.
- fig
-
__module__
= 'mpl_toolkits.axes_grid1.axes_grid'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
get_axes_pad
(self)[source]¶ Return the axes padding.
Returns: - hpad, vpad
Padding (horizontal pad, vertical pad) in inches.
-
set_axes_pad
(self, axes_pad)[source]¶ Set the padding between the axes.
Parameters: - axes_pad(float, float)
The padding (horizontal pad, vertical pad) in inches.
-
set_label_mode
(self, mode)[source]¶ Define which axes have tick labels.
Parameters: - mode{"L", "1", "all"}
The label mode:
- "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.
- fig