mpl_toolkits.axisartist.axislines.Axes#

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

基类:Axes

在图形中构建一个轴。

参数:
fig

Axes 是在 Figure fig 中构建的。

*args

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

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

sharex, sharey : Axes, 可选坐标轴,可选

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

frameonbool, 默认值: True

Axes 框架是否可见。

box_aspectfloat, 可选

为 Axes 框设置固定的纵横比,即高度与宽度的比率。详情请参见 set_box_aspect

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

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

**kwargs

其他可选的关键字参数:

属性

描述

可调整

{'box', 'datalim'}

agg_filter

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

alpha

标量或无

锚点

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

animated

布尔值

aspect

{'auto', 'equal'} 或 float

autoscale_on

布尔值

autoscalex_on

未知

autoscaley_on

未知

axes_locator

Callable[[Axes, Renderer], Bbox]

axisbelow

布尔值或 'line'

box_aspect

浮点数或无

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

补丁或(路径,变换)或无

facecolor 或 fc

color

figure

FigureSubFigure

forward_navigation_events

布尔值或“自动”

frame_on

布尔值

gid

str

in_layout

布尔值

标签

对象

鼠标悬停

布尔值

导航

布尔值

navigate_mode

未知

path_effects

AbstractPathEffect 的列表

picker

None 或 bool 或 float 或 callable

位置

[左, 底, 宽, 高] 或 Bbox

prop_cycle

Cycler

rasterization_zorder

浮点数或无

光栅化

布尔值

sketch_params

(scale: float, length: float, randomness: float)

snap

布尔值或无

subplotspec

未知

标题

str

transform

Transform

url

str

可见

布尔值

xbound

(下限: 浮点数, 上限: 浮点数)

xlabel

str

xlim

(左: 浮点数, 右: 浮点数)

xmargin

浮点数大于 -0.5

xscale

未知

xticklabels

未知

xticks

未知

ybound

(下限: 浮点数, 上限: 浮点数)

ylabel

str

ylim

(底部: 浮点数, 顶部: 浮点数)

ymargin

浮点数大于 -0.5

yscale

未知

yticklabels

未知

yticks

未知

zorder

浮动

返回:
Axes

新的 Axes 对象。

__call__(*args, **kwargs)[源代码][源代码]#

[已弃用]

注释

自 3.8 版本弃用: 使用 ax.axis 代替。

property 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))
选项布尔值或字符串

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

描述

'关闭' 或

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

'on' 或 True

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

'等于'

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

'缩放'

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

'紧密'

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

'自动'

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

'图像'

'scaled' 与数据范围相等的轴限制。

'平方'

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

发出bool, 默认值: True

观察者是否会被通知轴限制的改变。此选项会传递给 set_xlimset_ylim

返回:
xmin, xmax, ymin, ymax浮动

坐标轴的限制。

注释

对于3D轴,此方法额外接受 zminzmax 作为参数,并同样返回它们。

clear()[源代码][源代码]#

清除坐标轴。

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

一次性设置多个属性。

支持的属性是

属性

描述

可调整

{'box', 'datalim'}

agg_filter

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

alpha

标量或无

锚点

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

animated

布尔值

aspect

{'auto', 'equal'} 或 float

autoscale_on

布尔值

autoscalex_on

未知

autoscaley_on

未知

axes_locator

Callable[[Axes, Renderer], Bbox]

axisbelow

布尔值或 'line'

box_aspect

浮点数或无

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

补丁或(路径,变换)或无

facecolor 或 fc

color

figure

FigureSubFigure

forward_navigation_events

布尔值或“自动”

frame_on

布尔值

gid

str

in_layout

布尔值

标签

对象

鼠标悬停

布尔值

导航

布尔值

navigate_mode

未知

path_effects

AbstractPathEffect 的列表

picker

None 或 bool 或 float 或 callable

位置

[左, 底, 宽, 高] 或 Bbox

prop_cycle

Cycler

rasterization_zorder

浮点数或无

光栅化

布尔值

sketch_params

(scale: float, length: float, randomness: float)

snap

布尔值或无

subplotspec

未知

标题

str

transform

Transform

url

str

可见

布尔值

xbound

(下限: 浮点数, 上限: 浮点数)

xlabel

str

xlim

(左: 浮点数, 右: 浮点数)

xmargin

浮点数大于 -0.5

xscale

未知

xticklabels

未知

xticks

未知

ybound

(下限: 浮点数, 上限: 浮点数)

ylabel

str

ylim

(底部: 浮点数, 顶部: 浮点数)

ymargin

浮点数大于 -0.5

yscale

未知

yticklabels

未知

yticks

未知

zorder

浮动

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

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

轴方向

Axis Direction

轴方向演示

axis_direction demo

轴线样式

Axis line styles

曲线网格演示

Curvilinear grid demo

演示曲线线性网格2

Demo CurveLinear Grid2

floating_axes 功能

floating_axes features

floating_axis 演示

floating_axis demo

寄生轴演示

Parasite Axes demo

寄生轴演示

Parasite axis demo

刻度标签对齐

Ticklabel alignment

刻度标签方向

Ticklabel direction

简单的轴方向

Simple axis direction

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

Simple axis tick label and tick directions

简单轴垫

Simple axis pad

使用 axisartist 自定义轴脊

Custom spines with axisartist

简单轴线

Simple Axisline

简单轴线3

Simple Axisline3