mpl_toolkits.mplot3d.art3d.Text3D#
- class mpl_toolkits.mplot3d.art3d.Text3D(x=0, y=0, z=0, text='', zdir='z', **kwargs)[源代码][源代码]#
基类:
Text具有3D位置和方向的文本对象。
- 参数:
- x, y, z浮动
文本的位置。
- 文本str
要显示的文本字符串。
- zdir{'x', 'y', 'z', None, 3-tuple}
文本的方向。关于值的描述,请参见
get_dir_vector。
- 其他参数:
- **kwargs
所有其他参数都会传递给
Text。
在 x, y 位置创建一个带有字符串 text 的
Text实例。文本相对于锚点 (x, y) 根据 ``horizontalalignment``(默认:'left')和 ``verticalalignment``(默认:'baseline')进行对齐。另请参阅 文本对齐。
虽然 Text 接受 'label' 关键字参数,但默认情况下它不会添加到图例的句柄中。
有效的关键字参数是:
属性
描述
一个过滤函数,它接收一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和两个从图像左下角开始的偏移量
标量或无
布尔值
布尔值
带有
patches.FancyBboxPatch属性的字典未知
未知
未知
颜色或 cfontfamily或 family 或 fontname{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties或 font 或 font_propertiesfontsize或 size浮点数或 {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch或 stretch{一个数值范围在0-1000之间, '超压缩', '特压缩', '压缩', '半压缩', '正常', '半扩展', '扩展', '特扩展', '超扩展'}
fontstyle或样式{'normal', 'italic', 'oblique'}
fontvariant或 variant{'normal', 'small-caps'}
fontweight或 weight{一个数值范围在0-1000,'超轻','轻','正常','常规','书','中等','罗马','半粗','半粗','半','粗','重','特粗','黑'}
str
horizontalalignment或 ha{'left', 'center', 'right'}
布尔值
对象
浮动(字体大小的倍数)
str
布尔值
multialignment或 ma{'left', 'right', 'center'}
布尔值
None 或 bool 或 float 或 callable
(浮点数, 浮点数)
布尔值
浮点数 或 {'垂直', '水平'}
{None, 'default', 'anchor'}
(scale: float, length: float, randomness: float)
布尔值或无
对象
布尔值
str
bool, 默认值:
rcParams["text.usetex"](default:False)垂直对齐或 va{'baseline', 'bottom', 'center', 'center_baseline', 'top'}
布尔值
布尔值
浮动
浮动
浮动
- draw(renderer)[源代码][源代码]#
使用给定的渲染器绘制艺术家(及其子项)。
如果艺术家不可见(
Artist.get_visible返回 False),则此操作无效。- 参数:
- 渲染器 :
RendererBase子类。RendererBase 子类。
- 渲染器 :
注释
此方法在 Artist 子类中被重写。
- get_tightbbox(renderer=None)[源代码][源代码]#
类似于
Artist.get_window_extent,但包括任何裁剪。- 参数:
- 渲染器 :
RendererBase子类, 可选RendererBase 子类,可选 用于绘制图形的渲染器(即
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>)[源代码]#
一次性设置多个属性。
支持的属性是
属性
描述
浮动
一个过滤函数,它接收一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和两个从图像左下角开始的偏移量
标量或无
布尔值
布尔值
带有
patches.FancyBboxPatch属性的字典BboxBase或 None布尔值
补丁或(路径,变换)或无
颜色或 cfontfamily或 family 或 fontname{FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}
fontproperties或 font 或 font_propertiesfontsize或 size浮点数或 {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
fontstretch或 stretch{一个数值范围在0-1000之间, '超压缩', '特压缩', '压缩', '半压缩', '正常', '半扩展', '扩展', '特扩展', '超扩展'}
fontstyle或样式{'normal', 'italic', 'oblique'}
fontvariant或 variant{'normal', 'small-caps'}
fontweight或 weight{一个数值范围在0-1000,'超轻','轻','正常','常规','书','中等','罗马','半粗','半粗','半','粗','重','特粗','黑'}
str
horizontalalignment或 ha{'left', 'center', 'right'}
布尔值
对象
浮动(字体大小的倍数)
str
布尔值
multialignment或 ma{'left', 'right', 'center'}
布尔值
None 或 bool 或 float 或 callable
(浮点数, 浮点数)
(浮点数, 浮点数, 浮点数)
布尔值
浮点数 或 {'垂直', '水平'}
{None, 'default', 'anchor'}
(scale: float, length: float, randomness: float)
布尔值或无
对象
布尔值
str
bool, 默认值:
rcParams["text.usetex"](default:False)垂直对齐或 va{'baseline', 'bottom', 'center', 'center_baseline', 'top'}
布尔值
布尔值
浮动
浮动
浮动
浮动
- set_3d_properties(z=0, zdir='z')[源代码][源代码]#
设置文本的 z 位置和方向。
- 参数:
- z浮动
三维空间中的z轴位置。
- zdir{'x', 'y', 'z', 3-tuple}
文本的方向。默认值:'z'。关于值的描述,请参见
get_dir_vector。
- set_position_3d(xyz, zdir=None)[源代码][源代码]#
设置文本的 (x, y, z) 位置。
- 参数:
- xyz(浮点数, 浮点数, 浮点数)
三维空间中的位置。
- zdir{'x', 'y', 'z', None, 3-tuple}
文本的方向。如果未指定,zdir 将不会改变。有关值的描述,请参见
get_dir_vector。