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)[源代码]

基类:object

轴的网格。

在Matplotlib中,轴的位置(和大小)是在标准化地物坐标中指定的。对于需要以给定宽高比显示的图像,这可能不是理想的;例如,很难在相同大小的多个图像之间使用固定的填充来显示它们。在这种情况下可以使用AxesGrid。

参数:
figFigure图形

父图形。

rect(float,float,float,float)或int

轴的位置,如 (left, bottom, width, height) 元组或作为三位数的子批次位置代码(例如“121”)。

nrows_ncols(内景,内景)

网格中的行数和列数。

ngridsint或None,默认值:None

如果没有,只有第一个 NGRADE 将创建栅格中的轴。

direction{“row”,“column”},默认值:“row”

轴是按行的主要顺序(“逐行”)还是按列的主要顺序(“逐列”)创建的。

axes_pad浮点或(浮点,浮点),默认值:0.02

轴之间的填充或(水平填充、垂直填充),以英寸为单位。

add_allbool,默认值:True

是否使用将轴添加到图形中 Figure.add_axes . 此参数已弃用。

share_allbool,默认值:False

是否所有轴共享其x轴和y轴。覆盖 share_xshare_y .

share_xbool,默认值:True

列的所有轴是否共享其x轴。

share_ybool,默认值:True

行的所有轴是否共享其y轴。

label_mode{“L”,“1”,“all”},默认值:“L”

确定哪些轴将获得刻度标签:

  • “L”:左栏上的所有轴都得到垂直刻度标签;最下面一行的所有坐标轴都得到水平刻度标签。
  • “1”:只有左下角的轴被标记。
  • “全部”:所有轴都有标签。
axes_class 子类 matplotlib.axes.Axes ,默认值:无亚类
aspectbool,默认值:False

轴纵横比是否遵循数据限制的纵横比。

__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>, '__annotations__': {}})
__getitem__(i)[源代码]
__init__(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)[源代码]
参数:
figFigure图形

父图形。

rect(float,float,float,float)或int

轴的位置,如 (left, bottom, width, height) 元组或作为三位数的子批次位置代码(例如“121”)。

nrows_ncols(内景,内景)

网格中的行数和列数。

ngridsint或None,默认值:None

如果没有,只有第一个 NGRADE 将创建栅格中的轴。

direction{“row”,“column”},默认值:“row”

轴是按行的主要顺序(“逐行”)还是按列的主要顺序(“逐列”)创建的。

axes_pad浮点或(浮点,浮点),默认值:0.02

轴之间的填充或(水平填充、垂直填充),以英寸为单位。

add_allbool,默认值:True

是否使用将轴添加到图形中 Figure.add_axes . 此参数已弃用。

share_allbool,默认值:False

是否所有轴共享其x轴和y轴。覆盖 share_xshare_y .

share_xbool,默认值:True

列的所有轴是否共享其x轴。

share_ybool,默认值:True

行的所有轴是否共享其y轴。

label_mode{“L”,“1”,“all”},默认值:“L”

确定哪些轴将获得刻度标签:

  • “L”:左栏上的所有轴都得到垂直刻度标签;最下面一行的所有坐标轴都得到水平刻度标签。
  • “1”:只有左下角的轴被标记。
  • “全部”:所有轴都有标签。
axes_class 子类 matplotlib.axes.Axes ,默认值:无亚类
aspectbool,默认值:False

轴纵横比是否遵循数据限制的纵横比。

__len__()[源代码]
__module__ = 'mpl_toolkits.axes_grid1.axes_grid'
__weakref__

对象的弱引用列表(如果已定义)

get_aspect()[源代码]

返回子分片器的方面。

get_axes_locator()[源代码]
get_axes_pad()[源代码]

返回轴填充。

返回:
hpad、vpad

填充(水平垫、垂直垫)以英寸为单位。

get_divider()[源代码]
get_geometry()[源代码]

以(nrows,ncol)形式返回网格的行数和列数。

get_vsize_hsize()[源代码]
set_aspect(aspect)[源代码]

设置子分片器的方面。

set_axes_locator(locator)[源代码]
set_axes_pad(axes_pad)[源代码]

设置轴之间的填充。

参数:
axes_pad(浮标,浮标)

填充(水平垫、垂直垫)以英寸为单位。

set_label_mode(mode)[源代码]

定义哪些轴具有刻度标签。

参数:
mode{“L”,“1”,“all”}

标签模式:

  • “L”:左栏上的所有轴都得到垂直刻度标签;最下面一行的所有坐标轴都得到水平刻度标签。
  • “1”:只有左下角的轴被标记。
  • “全部”:所有轴都有标签。

使用实例 mpl_toolkits.axes_grid1.axes_grid.Grid