mpl_toolkits.axisartist.axislines.Axes#

mpl_toolkits.axisartist.axislines.Axes(*args, grid_helper=None, **kwargs)[源代码]#

基类: Axes

在图中构建一个 Axes。

参数:
figFigure

此Axes在Figure fig中构建。

*args

*args 可以是一个单独的 (left, bottom, width, height) 矩形或一个单独的 Bbox。这指定了Axes在图形坐标中的位置矩形。

*args 也可以由三个数字或一个三位数字组成;在后一种情况下,这些数字被视为独立的数字。这些数字被解释为 (nrows, ncols, index)(nrows, ncols) 指定了子图数组的大小,而 index 是正在创建的子图的基于1的索引。最后, *args 也可以直接是一个 SubplotSpec 实例。

sharex, shareyAxes, 可选

x轴或y轴与输入axis的x轴或y轴共享Axes。请注意,无法取消共享轴。

frameonbool,默认值:True

Axes 框架是否可见。

box_aspectfloat,可选

为Axes框设置固定宽高比,即高度与宽度的比率。有关详细信息,请参阅 set_box_aspect

forward_navigation_eventsbool 或 "auto",默认值:"auto"

控制平移/缩放事件是否传递给其下方的 Axes。"auto" 表示对于具有不可见补丁的轴为 True,否则为 False

**kwargs

其他可选关键字参数

属性

描述

adjustable

{'box', 'datalim'}

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量

alpha

浮点数或 None

anchor

(float, float) 或 {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

animated

布尔值

aspect

{'auto', 'equal'} 或 float

autoscale_on

布尔值

autoscalex_on

未知

autoscaley_on

未知

axes_locator

可调用对象[[Axes, Renderer], Bbox]

axisbelow

布尔值 或 'line'

box_aspect

浮点数或 None

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

facecolor or fc

color

figure

Figure or SubFigure

forward_navigation_events

bool 或 "auto"

frame_on

布尔值

gid

str

in_layout

布尔值

label

object

mouseover

布尔值

navigate

布尔值

navigate_mode

未知

path_effects

AbstractPathEffect 列表

picker

None 或 布尔值 或 浮点数 或 可调用对象

position

[left, bottom, width, height] 或 Bbox

prop_cycle

Cycler

rasterization_zorder

浮点数或 None

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

subplotspec

未知

title

str

transform

变换

url

str

visible

布尔值

xbound

(lower: float, upper: float)

xlabel

str

xlim

(left: float, right: float)

xmargin

float 大于 -0.5

xscale

未知

xticklabels

未知

xticks

未知

ybound

(lower: float, upper: float)

ylabel

str

ylim

(bottom: float, top: float)

ymargin

float 大于 -0.5

yscale

未知

yticklabels

未知

yticks

未知

zorder

浮点数

返回:
Axes

新的 Axes 对象。

属性 axis#

获取或设置某些轴属性的便捷方法。

调用签名

xmin, xmax, ymin, ymax = axis()
xmin, xmax, ymin, ymax = axis([xmin, xmax, ymin, ymax])
xmin, xmax, ymin, ymax = axis(option)
xmin, xmax, ymin, ymax = axis(**kwargs)
参数:
xmin, xmax, ymin, ymaxfloat, 可选

要设置的坐标轴限制。也可以通过以下方式实现:

ax.set(xlim=(xmin, xmax), ylim=(ymin, ymax))
optionbool 或 str

如果是布尔值,则打开或关闭坐标轴线和标签。如果是字符串,可能的值有:

描述

'off' 或 False

隐藏所有坐标轴装饰,即坐标轴标签、轴脊、刻度线、刻度标签和网格线。这与 set_axis_off() 相同。

'on' 或 True

不隐藏所有坐标轴装饰,即坐标轴标签、轴脊、刻度线、刻度标签和网格线。这与 set_axis_on() 相同。

'equal'

通过改变坐标轴限制来设置等比例缩放(即,使圆形保持圆形)。这与 ax.set_aspect('equal', adjustable='datalim') 相同。在这种情况下,显式数据限制可能不受尊重。

'scaled'

通过改变绘图框的尺寸来设置等比例缩放(即,使圆形保持圆形)。这与 ax.set_aspect('equal', adjustable='box', anchor='C') 相同。此外,将禁用进一步的自动缩放。

'tight'

设置恰好足够大以显示所有数据的限制,然后禁用进一步的自动缩放。

'auto'

自动缩放(用数据填充绘图框)。

'image'

'scaled',且坐标轴限制等于数据限制。

'square'

方形绘图;类似于 'scaled',但最初强制 xmax-xmin == ymax-ymin

emitbool, 默认值: True

观察者是否收到轴限制更改的通知。此选项将传递给 set_xlimset_ylim

返回:
xmin, xmax, ymin, ymaxfloat

坐标轴限制。

备注

对于3D坐标轴,此方法还接受 zminzmax 作为参数并相应返回它们。

clear()[源代码]#

清除 Axes。

get_children()[源代码]#

返回此Artist的子Artist列表。

get_grid_helper()[源代码]#
grid(visible=None, which='major', axis='both', **kwargs)[源代码]#

切换网格线,并可选地设置线的属性。

new_fixed_axis(loc, offset=None)[源代码]#
new_floating_axis(nth_coord, value, axis_direction='bottom')[源代码]#
set(*, adjustable=<UNSET>, agg_filter=<UNSET>, alpha=<UNSET>, anchor=<UNSET>, animated=<UNSET>, aspect=<UNSET>, autoscale_on=<UNSET>, autoscalex_on=<UNSET>, autoscaley_on=<UNSET>, axes_locator=<UNSET>, axisbelow=<UNSET>, box_aspect=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, facecolor=<UNSET>, forward_navigation_events=<UNSET>, frame_on=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, navigate=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, prop_cycle=<UNSET>, rasterization_zorder=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, subplotspec=<UNSET>, title=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xbound=<UNSET>, xlabel=<UNSET>, xlim=<UNSET>, xmargin=<UNSET>, xscale=<UNSET>, xticklabels=<UNSET>, xticks=<UNSET>, ybound=<UNSET>, ylabel=<UNSET>, ylim=<UNSET>, ymargin=<UNSET>, yscale=<UNSET>, yticklabels=<UNSET>, yticks=<UNSET>, zorder=<UNSET>)[源代码]#

一次性设置多个属性。

支持的属性包括:

属性

描述

adjustable

{'box', 'datalim'}

agg_filter

一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量

alpha

浮点数或 None

anchor

(float, float) 或 {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}

animated

布尔值

aspect

{'auto', 'equal'} 或 float

autoscale_on

布尔值

autoscalex_on

未知

autoscaley_on

未知

axes_locator

可调用对象[[Axes, Renderer], Bbox]

axisbelow

布尔值 或 'line'

box_aspect

浮点数或 None

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

facecolor or fc

color

figure

Figure or SubFigure

forward_navigation_events

bool 或 "auto"

frame_on

布尔值

gid

str

in_layout

布尔值

label

object

mouseover

布尔值

navigate

布尔值

navigate_mode

未知

path_effects

AbstractPathEffect 列表

picker

None 或 布尔值 或 浮点数 或 可调用对象

position

[left, bottom, width, height] 或 Bbox

prop_cycle

Cycler

rasterization_zorder

浮点数或 None

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

subplotspec

未知

title

str

transform

变换

url

str

visible

布尔值

xbound

(lower: float, upper: float)

xlabel

str

xlim

(left: float, right: float)

xmargin

float 大于 -0.5

xscale

未知

xticklabels

未知

xticks

未知

ybound

(lower: float, upper: float)

ylabel

str

ylim

(bottom: float, top: float)

ymargin

float 大于 -0.5

yscale

未知

yticklabels

未知

yticks

未知

zorder

浮点数

toggle_axisline(b=None)[源代码]#

使用 mpl_toolkits.axisartist.axislines.Axes 的示例#

轴方向

轴方向

轴方向演示

轴方向演示

轴线样式

轴线样式

曲线网格演示

曲线网格演示

曲线网格演示2

曲线网格演示2

floating_axes 特性

floating_axes 特性

浮动轴演示

浮动轴演示

寄生坐标轴演示

寄生坐标轴演示

寄生轴演示

寄生轴演示

刻度标签对齐

刻度标签对齐

刻度标签方向

刻度标签方向

简单轴方向

简单轴方向

简单轴刻度标签和刻度方向

简单轴刻度标签和刻度方向

简单轴填充

简单轴填充

使用 axisartist 自定义坐标轴脊线

使用 axisartist 自定义坐标轴脊线

简单轴线

简单轴线

简单轴线3

简单轴线3