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.get_visible返回 False),则此操作无效。- 参数:
- 渲染器 :
RendererBase子类。RendererBase 子类。
- 渲染器 :
注释
此方法在 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) 数组和图像左下角的两个偏移量
标量或无
布尔值
布尔值
{"left", "bottom", "right", "top"}
带有
patches.FancyBboxPatch属性的字典BboxBase或 None布尔值
补丁或(路径,变换)或无
颜色或 c{"left", "bottom", "right", "top"}
{"left", "bottom", "right", "top"}
fontfamily或 family 或 fontname{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties或 font 或 font_properties字体大小或大小浮点数或 {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch或 stretch{一个数值范围在0-1000之间, '超压缩', '额外压缩', '压缩', '半压缩', '正常', '半扩展', '扩展', '额外扩展', '超扩展'}
字体样式或样式{'normal', 'italic', 'oblique'}
fontvariant或 variant{'normal', 'small-caps'}
fontweight或 weight{一个数值范围在0-1000,'超轻','轻','正常','常规','书','中等','罗马','半粗','半粗','半','粗','重','特粗','黑'}
str
horizontalalignment或 ha{'left', 'center', 'right'}
布尔值
对象
浮动(字体大小的倍数)
未知
str
布尔值
多重对齐或 ma{'left', 'right', 'center'}
浮动
布尔值
None 或 bool 或 float 或 callable
(浮点数, 浮点数)
布尔值
float 或 {'vertical', 'horizontal'}
{None, 'default', 'anchor'}
(scale: float, length: float, randomness: float)
布尔值或无
对象
布尔值
str
bool, 默认值:
rcParams["text.usetex"](default:False)垂直对齐或 va{'baseline', 'bottom', 'center', 'center_baseline', 'top'}
布尔值
布尔值
浮动
浮动
浮动
- set_axis_direction(label_direction)[源代码][源代码]#
根据 Matplotlib 的约定调整刻度标签的文本角度和文本对齐方式。
label_direction必须是 [left, right, bottom, top] 之一。属性
左
底部
正确
顶部
ticklabel 角度
90
0
-90
180
ticklabel va
中心
基线
中心
基线
ticklabel ha
正确
中心
正确
中心
请注意,文本角度实际上是相对于(90 + 刻度标签方向的角度)的,这为底部轴提供了0度。
- 参数:
- 标签方向{"left", "bottom", "right", "top"}