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
。
在x、y处创建
Text
实例,并显示字符串text。文本相对于锚点 (x, y) 进行对齐,对齐方式由
horizontalalignment
(默认值:'left')和verticalalignment
(默认值:'baseline')决定。另请参阅文本对齐。虽然 Text 接受 'label' 关键字参数,但默认情况下它不会添加到图例的句柄中。
有效的关键字参数有:
属性
描述
一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量
浮点数或 None
布尔值
布尔值
包含
patches.FancyBboxPatch
属性的字典未知
未知
未知
{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'}
布尔值
布尔值
浮点数
浮点数
浮点数
- draw(renderer)[source]#
使用给定的渲染器绘制 Artist(及其子对象)。
如果艺术家不可见(
Artist.get_visible
返回False),此操作将无效。- 参数:
- renderer
RendererBase
子类。
- renderer
备注
此方法在 Artist 子类中被覆盖。
- get_tightbbox(renderer=None)[source]#
类似于
Artist.get_window_extent
,但包含任何裁剪。- 参数:
- renderer
RendererBase
子类,可选 用于绘制图形的渲染器(即
fig.canvas.get_renderer()
)
- 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]#
一次性设置多个属性。
支持的属性包括:
属性
描述
浮点数
一个过滤函数,它接受一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组以及图像左下角的两个偏移量
浮点数或 None
布尔值
布尔值
包含
patches.FancyBboxPatch
属性的字典BboxBase
或 None布尔值
Patch 或 (Path, Transform) 或 None
{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, float, float)
布尔值
float 或 {'vertical', 'horizontal'}
{None, 'default', 'anchor'}
(scale: 浮点数, length: 浮点数, randomness: 浮点数)
布尔值或 None
object
布尔值
str
布尔值,默认值:
rcParams["text.usetex"]
(默认值:False
){'baseline', 'bottom', 'center', 'center_baseline', 'top'}
布尔值
布尔值
浮点数
浮点数
浮点数
浮点数
- 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
。