mpl_toolkits.axisartist.axis_artist.Ticks#

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

基类:AttributeCopier, Line2D

刻度线源自 Line2D,需要注意的是,刻度线本身是标记。因此,你应该使用 set_mec, set_mew 等方法。

要更改刻度大小(长度),您需要使用 set_ticksize。要更改刻度的方向(默认情况下,刻度与刻度标签方向相反),请使用 set_tick_out(False)

draw(renderer)[源代码][源代码]#

使用给定的渲染器绘制艺术家(及其子项)。

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

参数:
渲染器 : RendererBase 子类。RendererBase 子类。

注释

此方法在 Artist 子类中被重写。

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

返回线条颜色。

另请参见 set_color

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

返回标记边缘颜色。

另请参见 set_markeredgecolor

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

返回标记边缘的宽度,单位为点。

另请参见 set_markeredgewidth

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

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

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

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

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

返回刻度线的长度,单位为点。

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

一次性设置多个属性。

支持的属性是

属性

描述

agg_filter

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

alpha

标量或无

animated

布尔值

抗锯齿 或 aa

布尔值

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

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

颜色 或 c

未知

dash_capstyle

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

dash_joinstyle

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

虚线

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

数据

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

drawstyle 或 ds

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

figure

FigureSubFigure

fillstyle

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

gapcolor

color or None

gid

str

in_layout

布尔值

标签

对象

linestyle 或 ls

{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}

linewidth 或 lw

float

locs_angles

未知

标记

标记样式字符串,PathMarkerStyle

markeredgecolor 或 mec

color

markeredgewidth 或 mew

float

markerfacecolor 或 mfc

color

markerfacecoloralt 或 mfcalt

color

markersize 或 ms

float

markevery

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

鼠标悬停

布尔值

路径效果

AbstractPathEffect 列表

picker

浮点数或可调用对象[[Artist, Event], 元组[bool, dict]]

pickradius

float

光栅化

布尔值

sketch_params

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

snap

布尔值或无

solid_capstyle

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

solid_joinstyle

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

tick_out

未知

ticksize

未知

transform

Transform

url

str

visible

布尔值

xdata

一维数组

ydata

一维数组

zorder

float

set_color(color)[源代码][源代码]#

设置线条的颜色。

参数:
颜色 : color颜色
set_locs_angles(locs_angles)[源代码][源代码]#
set_tick_out(b)[源代码][源代码]#

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

set_ticksize(ticksize)[源代码][源代码]#

设置刻度的长度,单位为点。