mpl_toolkits.axisartist.axis_artist.Ticks#

class mpl_toolkits.axisartist.axis_artist.Ticks(ticksize, tick_out=False, *, axis=None, **kwargs)[source]#

基类: AttributeCopier, Line2D

刻度线派生自 Line2D,请注意刻度线本身就是标记。因此,您应该使用 set_mec、set_mew 等方法。

要更改刻度线尺寸(长度),您需要使用 set_ticksize。要更改刻度线方向(刻度线默认与刻度标签方向相反),请使用 set_tick_out(False)

draw(renderer)[source]#

使用给定的渲染器绘制 Artist(及其子对象)。

如果艺术家不可见(Artist.get_visible 返回 False),则此操作无效。

参数:
渲染器RendererBase 子类。

备注

此方法在 Artist 子类中被覆盖。

get_color()[source]#

返回线条颜色。

另请参阅 set_color

get_markeredgecolor()[source]#

返回标记边缘颜色。

另请参阅 set_markeredgecolor

get_markeredgewidth()[source]#

返回标记边缘宽度(点)。

另请参阅 set_markeredgewidth

get_ref_artist()[source]#

返回实际定义此 artist 的某些属性(例如,颜色)的基础 artist。

get_tick_out()[source]#

返回刻度线是绘制在坐标轴内部还是外部。

get_ticksize()[source]#

返回刻度线长度(点)。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, dash_capstyle=<UNSET>, dash_joinstyle=<UNSET>, dashes=<UNSET>, data=<UNSET>, drawstyle=<UNSET>, fillstyle=<UNSET>, gapcolor=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, locs_angles=<UNSET>, marker=<UNSET>, markeredgecolor=<UNSET>, markeredgewidth=<UNSET>, markerfacecolor=<UNSET>, markerfacecoloralt=<UNSET>, markersize=<UNSET>, markevery=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, pickradius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, solid_capstyle=<UNSET>, solid_joinstyle=<UNSET>, tick_out=<UNSET>, ticksize=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xdata=<UNSET>, ydata=<UNSET>, zorder=<UNSET>)[source]#

一次性设置多个属性。

支持的属性包括:

属性

描述

agg_filter

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

alpha

浮点数或 None

animated

布尔值

antialiasedaa

布尔值

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

colorc

未知

dash_capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

dash_joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

dashes

浮点数序列(点中的开/关墨迹)或 (None, None)

data

(2, N) 数组或两个一维数组

drawstyleds

{'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'},默认值: 'default'

figure

FigureSubFigure

fillstyle

{'full', 'left', 'right', 'bottom', 'top', 'none'}

gapcolor

颜色 或 None

gid

字符串

in_layout

布尔值

label

对象

linestylels

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidthlw

浮点数

locs_angles

未知

marker

标记样式字符串,PathMarkerStyle

markeredgecolormec

颜色

markeredgewidthmew

浮点数

markerfacecolormfc

颜色

markerfacecoloraltmfcalt

颜色

markersizems

浮点数

markevery

None 或 int 或 (int, int) 或 slice 或 list[int] 或 float 或 (float, float) 或 list[bool]

mouseover

布尔值

path_effects

AbstractPathEffect 列表

picker

浮点数或 callable[[Artist, Event], tuple[bool, dict]]

pickradius

浮点数

rasterized

布尔值

sketch_params

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

snap

布尔值或 None

solid_capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

solid_joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

tick_out

未知

ticksize

未知

transform

变换

url

字符串

visible

布尔值

xdata

一维数组

ydata

一维数组

zorder

浮点数

set_color(color)[source]#

设置线条颜色。

参数:
color颜色
set_locs_angles(locs_angles)[source]#
set_tick_out(b)[source]#

设置刻度线是绘制在坐标轴内部还是外部。

set_ticksize(ticksize)[source]#

设置刻度线长度(点)。