mpl_toolkits.axes_grid1.axes_divider.Divider#

class mpl_toolkits.axes_grid1.axes_divider.Divider(fig, pos, horizontal, vertical, aspect=None, anchor='C')[source]#

基类: object

一个 Axes 定位类。

此分隔器通过水平和垂直尺寸列表(mpl_toolkits.axes_grid1.axes_size)进行初始化,据此划分给定的矩形区域。

new_locator 方法随后创建一个可调用对象,可用作轴的 axes_locator

参数:
figFigure 对象
pos包含 4 个浮点数的元组

将被划分的矩形位置。

horizontalaxes_size 列表

水平划分的尺寸。

verticalaxes_size 列表

垂直划分的尺寸。

aspect布尔值,可选

是否缩小整体矩形区域,使水平和垂直尺度的相对部分具有相同的比例。

anchor(浮点数, 浮点数) 或 {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'},默认值: 'C'

aspect 为 True 时,缩小矩形的位置。

add_auto_adjustable_area(use_axes, pad=0.1, adjust_dirs=None)[source]#

use_axes 周围添加自动调整的填充,以便在布局时考虑它们的装饰(标题、标签、刻度、刻度标签)。

参数:
use_axesAxesAxes 列表

要考虑其装饰的 Axes 对象。

pad浮点数,默认值: 0.1

额外的填充(英寸)。

adjust_dirs{"left", "right", "bottom", "top"} 列表,可选

添加填充的边;默认为所有四边。

append_size(position, size)[source]#
get_anchor()[source]#

返回锚点。

get_aspect()[source]#

返回纵横比。

get_horizontal()[source]#

返回水平尺寸。

get_horizontal_sizes(renderer)[source]#
get_locator()[source]#
get_position()[source]#

返回矩形的位置。

get_position_runtime(ax, renderer)[source]#
get_subplotspec()[source]#
get_vertical()[source]#

返回垂直尺寸。

get_vertical_sizes(renderer)[source]#
new_locator(nx, ny, nx1=None, ny1=None)[source]#

返回指定单元格的轴定位器可调用对象。

参数:
nx, nx1整数

指定单元格的列位置的整数。当 nx1 为 None 时,指定单个第 nx 列。否则,指定从 nxnx1(但不包括第 nx1 列)之间的列位置。

ny, ny1整数

nxnx1 相同,但用于行位置。

set_anchor(anchor)[source]#
参数:
anchor(浮点数, 浮点数) 或 {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}

可以是相对坐标的 (x, y) 对(0 为左或下,1 为右或上),'C'(中心),或一个基本方向('SW',西南,为左下角,依此类推)。

另请参阅

Axes.set_anchor
set_aspect(aspect=False)[source]#
参数:
aspect布尔值
set_horizontal(h)[source]#
参数:
haxes_size 列表

水平划分的尺寸

set_locator(_locator)[source]#
set_position(pos)[source]#

设置矩形的位置。

参数:
pos包含 4 个浮点数的元组

将被划分的矩形位置

set_vertical(v)[source]#
参数:
vaxes_size 列表

垂直划分的尺寸

使用 mpl_toolkits.axes_grid1.axes_divider.Divider 的示例#

HBoxDivider 和 VBoxDivider 演示

HBoxDivider 和 VBoxDivider 演示

具有固定物理大小的坐标轴

具有固定物理大小的坐标轴

简单坐标轴分隔器 1

简单坐标轴分隔器 1

简单坐标轴分隔器 3

简单坐标轴分隔器 3