matplotlib.figure.SubFigure.text#

SubFigure.text(x, y, s, fontdict=None, **kwargs)[source]#

向图形添加文本。

参数:
x, y浮点数

放置文本的位置。默认情况下,它位于图形坐标中,浮点数在 [0, 1] 范围内。可以通过使用 transform 关键字更改坐标系。

s字符串

文本字符串。

fontdict字典,可选

用于覆盖默认文本属性的字典。如果未给定,则默认值由 rcParams["font.*"] 确定。作为 kwargs 传入的属性将覆盖 fontdict 中给定的相应属性。

返回:
文本
其他参数:
**kwargsText 属性

其他杂项文本参数。

属性

描述

agg_filter

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

alpha

浮点数或 None

animated

布尔值

antialiased

布尔值

backgroundcolor

color

bbox

包含 patches.FancyBboxPatch 属性的字典

clip_box

未知

clip_on

未知

clip_path

未知

colorc

color

figure

FigureSubFigure

fontfamilyfamilyfontname

{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}

fontpropertiesfontfont_properties

font_manager.FontPropertiesstrpathlib.Path

fontsizesize

float 或 {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}

fontstretchstretch

{0-1000 范围内的数值, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}

fontstylestyle

{'normal', 'italic', 'oblique'}

fontvariantvariant

{'normal', 'small-caps'}

fontweightweight

{0-1000 范围内的数值, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}

gid

字符串

horizontalalignmentha

{'left', 'center', 'right'}

in_layout

布尔值

label

对象

linespacing

float (字体大小的倍数)

math_fontfamily

字符串

mouseover

布尔值

multialignmentma

{'left', 'right', 'center'}

parse_math

布尔值

path_effects

AbstractPathEffect 列表

picker

None 或 布尔值 或 浮点数 或 可调用对象

position

(浮点数, 浮点数)

rasterized

布尔值

rotation

float 或 {'vertical', 'horizontal'}

rotation_mode

{None, 'default', 'anchor'}

sketch_params

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

snap

布尔值或 None

text

对象

transform

变换

transform_rotates_text

布尔值

url

字符串

usetex

布尔值,默认值:rcParams["text.usetex"] (默认值:False)

verticalalignmentva

{'baseline', 'bottom', 'center', 'center_baseline', 'top'}

visible

布尔值

wrap

布尔值

x

浮点数

y

浮点数

zorder

浮点数

另请参阅

Axes.text
pyplot.text