mpl_toolkits.axisartist.axis_artist.TickLabels#
- class mpl_toolkits.axisartist.axis_artist.TickLabels(*, axis_direction='bottom', **kwargs)[源代码]#
基类:
AxisLabel
刻度标签。虽然派生自
Text
,但此单个艺术对象绘制所有刻度标签。如同AxisLabel
中一样,文本位置是实时更新的,因此改变文本位置无效。否则,可以像更改普通Text
对象一样更改其属性。与 Matplotlib 主线中的刻度标签不同,单个刻度标签的属性无法单独修改。要更改刻度和刻度标签之间的填充,请使用
set_pad
。- draw(renderer)[源代码]#
使用给定的渲染器绘制 Artist(及其子对象)。
如果艺术对象不可见(
Artist.get_visible
返回 False),此操作无效。- 参数:
- renderer
RendererBase
子类。
- renderer
备注
此方法在 Artist 子类中被覆盖。
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, axis_direction=<UNSET>, backgroundcolor=<UNSET>, bbox=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, default_alignment=<UNSET>, default_angle=<UNSET>, fontfamily=<UNSET>, fontproperties=<UNSET>, fontsize=<UNSET>, fontstretch=<UNSET>, fontstyle=<UNSET>, fontvariant=<UNSET>, fontweight=<UNSET>, gid=<UNSET>, horizontalalignment=<UNSET>, in_layout=<UNSET>, label=<UNSET>, linespacing=<UNSET>, locs_angles_labels=<UNSET>, math_fontfamily=<UNSET>, mouseover=<UNSET>, multialignment=<UNSET>, pad=<UNSET>, parse_math=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, rasterized=<UNSET>, rotation=<UNSET>, rotation_mode=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, text=<UNSET>, transform=<UNSET>, transform_rotates_text=<UNSET>, url=<UNSET>, usetex=<UNSET>, verticalalignment=<UNSET>, visible=<UNSET>, wrap=<UNSET>, x=<UNSET>, y=<UNSET>, zorder=<UNSET>)[源代码]#
一次性设置多个属性。
支持的属性包括:
属性
描述
一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量
浮点数或 None
布尔值
布尔值
{"left", "bottom", "right", "top"}
带有
patches.FancyBboxPatch
属性的字典BboxBase
或 None布尔值
Patch 或 (Path, Transform) 或 None
{"left", "bottom", "right", "top"}
{"left", "bottom", "right", "top"}
fontfamily
或family
或fontname
{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
float 或 {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
{0-1000 范围内的数值, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}
{'normal', 'italic', 'oblique'}
{'normal', 'small-caps'}
{0-1000 范围内的数值, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}
str
{'left', 'center', 'right'}
布尔值
object
float (字体大小的倍数)
未知
str
布尔值
{'left', 'right', 'center'}
浮点数
布尔值
None 或 布尔值 或 浮点数 或 可调用对象
(浮点数, 浮点数)
布尔值
float 或 {'vertical', 'horizontal'}
{None, 'default', 'anchor'}
(scale: 浮点数, length: 浮点数, randomness: 浮点数)
布尔值或 None
object
布尔值
str
布尔值,默认值:
rcParams["text.usetex"]
(默认值:False
){'baseline', 'bottom', 'center', 'center_baseline', 'top'}
布尔值
布尔值
浮点数
浮点数
浮点数
- set_axis_direction(label_direction)[源代码]#
根据 Matplotlib 约定调整刻度标签的文本角度和文本对齐方式。
label_direction 必须是以下之一:[left, right, bottom, top]。
属性
左
下
右
上
刻度标签角度
90
0
-90
180
刻度标签垂直对齐
居中
基线
居中
基线
刻度标签水平对齐
右
居中
右
居中
请注意,文本角度实际上是相对于 (90 + 刻度标签方向的角度) 的,对于底部轴线,这会得到 0。
- 参数:
- label_direction{"left", "bottom", "right", "top"}