mpl_toolkits.mplot3d.art3d.Text3D#

mpl_toolkits.mplot3d.art3d.Text3D(x=0, y=0, z=0, text='', zdir='z', axlim_clip=False, **kwargs)[source]#

基类: Text

具有三维位置和方向的文本对象。

参数:
x, y, z浮点数

文本的位置。

textstr

要显示的文本字符串。

zdir{'x', 'y', 'z', None, 3-tuple}

文本的方向。有关这些值的说明,请参见get_dir_vector

axlim_clip布尔值, 默认值: False

是否隐藏超出坐标轴视图限制的文本。

其他参数:
**kwargs

所有其他参数都传递给Text

xy处创建Text实例,并显示字符串text

文本相对于锚点 (x, y) 进行对齐,对齐方式由horizontalalignment(默认值:'left')和verticalalignment(默认值:'baseline')决定。另请参阅文本对齐

虽然 Text 接受 'label' 关键字参数,但默认情况下它不会添加到图例的句柄中。

有效的关键字参数有:

属性

描述

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

str

horizontalalignmentha

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

in_layout

布尔值

label

object

linespacing

float (字体大小的倍数)

math_fontfamily

str

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

object

transform

变换

transform_rotates_text

布尔值

url

str

usetex

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

verticalalignmentva

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

visible

布尔值

wrap

布尔值

x

浮点数

y

浮点数

zorder

浮点数

draw(renderer)[source]#

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

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

参数:
rendererRendererBase子类。

备注

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

get_position_3d()[source]#

返回文本的 (x, y, z) 位置。

get_tightbbox(renderer=None)[source]#

类似于Artist.get_window_extent,但包含任何裁剪。

参数:
rendererRendererBase子类,可选

用于绘制图形的渲染器(即 fig.canvas.get_renderer()

返回:
Bbox 或 None

封闭的边界框(以图形像素坐标表示)。如果剪裁导致没有交集,则返回 None。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, backgroundcolor=<UNSET>, bbox=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<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>, math_fontfamily=<UNSET>, mouseover=<UNSET>, multialignment=<UNSET>, parse_math=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, position=<UNSET>, position_3d=<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>, z=<UNSET>, zorder=<UNSET>)[source]#

一次性设置多个属性。

支持的属性包括:

属性

描述

3d_properties

浮点数

agg_filter

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

alpha

浮点数或 None

animated

布尔值

antialiased

布尔值

backgroundcolor

color

bbox

包含patches.FancyBboxPatch属性的字典

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

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

str

horizontalalignmentha

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

in_layout

布尔值

label

object

linespacing

float (字体大小的倍数)

math_fontfamily

str

mouseover

布尔值

multialignmentma

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

parse_math

布尔值

path_effects

AbstractPathEffect的列表

picker

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

position

(浮点数, 浮点数)

position_3d

(float, float, float)

rasterized

布尔值

rotation

float 或 {'vertical', 'horizontal'}

rotation_mode

{None, 'default', 'anchor'}

sketch_params

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

snap

布尔值或 None

text

object

transform

变换

transform_rotates_text

布尔值

url

str

usetex

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

verticalalignmentva

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

visible

布尔值

wrap

布尔值

x

浮点数

y

浮点数

z

浮点数

zorder

浮点数

set_3d_properties(z=0, zdir='z', axlim_clip=False)[source]#

设置文本的z位置和方向。

参数:
zfloat

三维空间中的z位置。

zdir{'x', 'y', 'z', 3-元组}

文本的方向。默认值:'z'。有关这些值的说明,请参见get_dir_vector

axlim_clip布尔值, 默认值: False

是否隐藏超出坐标轴视图限制的文本。

set_position_3d(xyz, zdir=None)[source]#

设置文本的 (x, y, z) 位置。

参数:
xyz(float, float, float)

三维空间中的位置。

zdir{'x', 'y', 'z', None, 3-tuple}

文本的方向。如果未指定,zdir将不会更改。有关这些值的说明,请参见get_dir_vector

set_z(z)[source]#

设置文本的z位置。

参数:
zfloat