matplotlib.mathtext

Inheritance diagram of matplotlib.mathtext

用于解析TeX数学语法子集并将其呈现给Matplotlib后端的模块。

有关其用法的教程,请参见 写数学表达式 . 本文件主要涉及实施细节。

模块使用 pyparsing 解析tex表达式。

支持Tex计算机现代字体和Stix字体的Bakoma发行版。对使用任意字体有实验性的支持,但是如果没有适当的调整和度量,结果可能会有所不同。

class matplotlib.mathtext.Accent(c, state, math=True)[源代码]

基类:matplotlib.mathtext.Char

对于重音符号,字体度量需要进行不同的处理,因为它们已经从TrueType字体的基线正确偏移。

grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

render(x, y)[源代码]

将角色渲染到画布。

shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.AutoHeightChar(c, height, depth, state, always=False, factor=None)[源代码]

基类:matplotlib.mathtext.Hlist

尽可能接近给定高度和深度的字符。

当使用具有某些字符的多个高度版本(如BaKoMa字体)的字体时,将选择正确的字形,否则将始终返回字形的缩放版本。

class matplotlib.mathtext.AutoWidthChar(c, width, state, always=False, char_class=<class 'matplotlib.mathtext.Char'>)[源代码]

基类:matplotlib.mathtext.Hlist

尽可能接近给定宽度的字符。

当使用具有某些字符的多个宽度版本(如BaKoMa字体)的字体时,将选择正确的字形,否则将始终返回字形的缩放版本。

class matplotlib.mathtext.BakomaFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.TruetypeFonts

使用Bakoma TrueType字体进行渲染。

符号散布在许多字体文件上,每个字体文件都有自己专有的8位编码。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

alias = '\\]'
get_sized_alternatives_for_symbol(fontname, sym)[源代码]

如果字体提供同一符号的多个大小,则重写。应返回匹配的符号列表 sym 各种尺寸。表达式渲染器将从此列表中为给定情况选择最合适的大小。

target = ']'
class matplotlib.mathtext.Box(width, height, depth)[源代码]

基类:matplotlib.mathtext.Node

具有物理位置的节点。

grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

render(x1, y1, x2, y2)[源代码]
shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.Char(c, state, math=True)[源代码]

基类:matplotlib.mathtext.Node

一个字符。

与TeX不同,字体信息和度量存储在每个 Char 以便于在需要时查找字体度量。请注意,TeX框具有宽度、高度和深度,这与Type1和TrueType不同,后者使用全边界框和x方向的前进。度量必须转换为TeX模型,并且进阶(如果与宽度不同)必须转换为 Kern 节点时 Char 添加到其父级 Hlist .

get_kerning(next)[源代码]

返回此字符与给定字符之间的紧排量。

当字符串在一起时调用此方法 Hlist 创造 Kern 节点。

grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

is_slanted()[源代码]
render(x, y)[源代码]

将角色渲染到画布

shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.ComputerModernFontConstants[源代码]

基类:matplotlib.mathtext.FontConstantsBase

delta = 0.075
delta_integral = 0.3
delta_slanted = 0.3
script_space = 0.075
sub1 = 0.2
sub2 = 0.3
subdrop = 0.2
sup1 = 0.45
class matplotlib.mathtext.DejaVuFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.UnicodeFonts

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

use_cmex = False
class matplotlib.mathtext.DejaVuSansFontConstants[源代码]

基类:matplotlib.mathtext.FontConstantsBase

class matplotlib.mathtext.DejaVuSansFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.DejaVuFonts

dejavu sans字体的字体处理类

如果找不到glyph,它将回退到stix sans

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

class matplotlib.mathtext.DejaVuSerifFontConstants[源代码]

基类:matplotlib.mathtext.FontConstantsBase

class matplotlib.mathtext.DejaVuSerifFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.DejaVuFonts

dejavu serif字体的字体处理类

如果找不到glyph,它将回退到stix serif

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

matplotlib.mathtext.Error(msg)[源代码]

帮助程序类以引发分析程序错误。

class matplotlib.mathtext.Fil[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.Fill[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.Filll[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.FontConstantsBase[源代码]

基类:object

一组常量,用于控制某些事物(如子脚本和上标)的布局。这些都是无法从字体本身的字体度量中可靠地检索到的度量。

delta = 0.025
delta_integral = 0.1
delta_slanted = 0.2
script_space = 0.05
sub1 = 0.3
sub2 = 0.5
subdrop = 0.4
sup1 = 0.7
class matplotlib.mathtext.Fonts(default_font_prop, mathtext_backend)[源代码]

基类:object

用于MathText的字体系统的抽象基类。

类必须能够获取符号键和字体文件名并返回字符度量。它还委托给后端类来进行实际的绘图。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

destroy()[源代码]

在对象即将被销毁之前修复任何循环引用。

get_kern(font1, fontclass1, sym1, fontsize1, font2, fontclass2, sym2, fontsize2, dpi)[源代码]

获取字体间距 sym1sym2 .

芬太克斯 :Tex字体名称之一:

tt, it, rm, cal, sf, bf or default/regular (non-math)

FordCaseX 待办事项

symX :原始tex形式的符号。例如,“1”、“X”或“Sigma”

芬茨赛克斯 :字体大小(以磅为单位)

dpi :当前每英寸点数

get_metrics(font, font_class, sym, fontsize, dpi, math=True)[源代码]

font :Tex字体名称之一:

tt, it, rm, cal, sf, bf or default/regular (non-math)

font_class 待办事项

sym :原始tex形式的符号。例如,“1”、“X”或“Sigma”

字体大小 :字体大小(以磅为单位)

dpi :当前每英寸点数

math :sym是否为数学字符

返回具有以下属性的对象:

  • 提前 :标志符号的前进距离(以点为单位)。
  • 高度 :标志符号的高度(以点为单位)。
  • 宽度 :字形的宽度(以点为单位)。
  • xminxmaxyminymax -字形的墨迹矩形
  • 冰山 -从基线到字形顶部的距离。这符合Tex对“高度”的定义。
get_results(box)[源代码]

获取后端渲染数学表达式所需的数据。返回值是后端特定的。

get_sized_alternatives_for_symbol(fontname, sym)[源代码]

如果字体提供同一符号的多个大小,则重写。应返回匹配的符号列表 sym 各种尺寸。表达式渲染器将从此列表中为给定情况选择最合适的大小。

get_underline_thickness(font, fontsize, dpi)[源代码]

获取与给定字体匹配的线条粗细。用作绘制分数或根号等线条的基本单位。

get_used_characters()[源代码]

获取数学表达式中使用的字符集。用于需要设置字体子集的后端,以便知道要包括哪些字形。

get_xheight(font, fontsize, dpi)[源代码]

获取给定的xheight font字体大小 .

render_glyph(ox, oy, facename, font_class, sym, fontsize, dpi)[源代码]

画字形

  • oxoy 位置
  • 面名 :一个tex面名称
  • font_class
  • sym :tex符号名或单个字符
  • 字体大小 :字体大小(以磅为单位)
  • dpi :要绘制的DPI。
render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制填充矩形( x1y1x2y2

set_canvas_size(w, h, d)[源代码]

设置用于呈现数学表达式的缓冲区的大小。只对位图后端真正必要。

class matplotlib.mathtext.Glue(glue_type, copy=<deprecated parameter>)[源代码]

基类:matplotlib.mathtext.Node

此对象中的大部分信息存储在底层 _GlueSpec 类,在多个粘合对象之间共享。(这是一个内存优化,可能不再重要了,但更容易坚持tex的做法。)

property glue_subtype
grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.GlueSpec(width=0.0, stretch=0.0, stretch_order=0, shrink=0.0, shrink_order=0)[源代码]

基类:object

[Deprecated] 见 Glue .

笔记

3.3 版后已移除.

copy()[源代码]
classmethod factory(glue_type)[源代码]
class matplotlib.mathtext.HCentered(elements)[源代码]

基类:matplotlib.mathtext.Hlist

创建一个 Hlist 其内容集中在其封闭框中。

class matplotlib.mathtext.Hbox(width)[源代码]

基类:matplotlib.mathtext.Box

只有宽度(高度和深度为零)的框。

class matplotlib.mathtext.Hlist(elements, w=0.0, m='additional', do_kern=True)[源代码]

基类:matplotlib.mathtext.List

一个水平的框列表。

hpack(w=0.0, m='additional')[源代码]

计算结果框的尺寸,如果预先指定了其中一个尺寸,则调整胶水。计算出的尺寸通常将所有材料都封装在新的盒子里;但是如果使用了负胶、盒子里的东西太满或者盒子里的东西太多,一些东西可能会粘在外面 \vbox 包括已左移的其他框。

参数:
w浮点,默认值:0

宽度。

m{'exactly','additional'},默认值:'additional'

是否生产宽度为“精确”的盒子 w ;或是一个具有自然宽度的盒子,再加上 w (“附加”)。

笔记

默认值生成一个具有内容自然宽度的框。

kern()[源代码]

插入 Kern 节点间 Char 要设置紧排的节点。

这个 Char 节点本身决定了它们需要的紧排量(在 get_kerning ),此函数只创建正确的链表。

class matplotlib.mathtext.Hrule(state, thickness=None)[源代码]

基类:matplotlib.mathtext.Rule

方便类来创建水平规则。

class matplotlib.mathtext.Kern(width)[源代码]

基类:matplotlib.mathtext.Node

A Kern 节点有一个宽度字段来指定(通常为负)间距。当字体设计人员说将A和V这样的字母靠得更近或更远时,这种间距更正会出现在水平列表中。紧排节点也可以出现在垂直列表中,当 宽度 表示垂直方向上的附加间距。

depth = 0
grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

height = 0
shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.List(elements)[源代码]

基类:matplotlib.mathtext.Box

节点列表(水平或垂直)。

grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.MathTextParser(output)[源代码]

基类:object

为给定后端创建MathTextParser 输出 .

get_depth(texstr, dpi=120, fontsize=14)[源代码]
参数:
texstrSTR

有效的mathtext字符串,例如r'IQ:$sigma_i=15$'。

dpi浮动

用于呈现文本的每英寸点数设置。

返回:
利息

基线距图像底部的偏移量,以像素为单位。

parse(s, dpi=72, prop=None)[源代码]

解析给定的数学表达式 s 在给定的 dpi . 如果 prop 提供,它是 FontProperties 对象,指定要在数学表达式中使用的“默认”字体,用于所有非数学文本。

结果被缓存,因此多次调用 parse 用同样的表达式应该是快速的。

to_mask(texstr, dpi=120, fontsize=14)[源代码]
参数:
texstrSTR

有效的mathtext字符串,例如r'IQ:$sigma_i=15$'。

dpi浮动

用于呈现文本的每英寸点数设置。

fontsize利息

以磅为单位的字体大小

返回:
array2D uint8阿尔法

栅格化纹理的掩模数组。

depth利息

基线距图像底部的偏移量,以像素为单位。

to_png(filename, texstr, color='black', dpi=120, fontsize=14)[源代码]

将tex表达式渲染为PNG文件。

参数:
filename

可写的文件名或文件对象。

texstrSTR

有效的mathtext字符串,例如r'IQ:$sigma_i=15$'。

color颜色

文本颜色。

dpi浮动

用于呈现文本的每英寸点数设置。

fontsize利息

以磅为单位的字体大小。

返回:
利息

基线距图像底部的偏移量,以像素为单位。

to_rgba(texstr, color='black', dpi=120, fontsize=14)[源代码]
参数:
texstrSTR

有效的mathtext字符串,例如r'IQ:$sigma_i=15$'。

color颜色

文本颜色。

dpi浮动

用于呈现文本的每英寸点数设置。

fontsize利息

以磅为单位的字体大小。

返回:
array(M,N,4)阵列

栅格化纹理的RGBA颜色值,用 颜色 .

depth利息

基线距图像底部的偏移量,以像素为单位。

exception matplotlib.mathtext.MathTextWarning[源代码]

基类:Warning

class matplotlib.mathtext.MathtextBackend[源代码]

基类:object

mathtext后端特定代码的基类。 MathtextBackend mathtext和特定Matplotlib图形后端之间的子类接口。

子类需要重写以下内容:

如果需要使用freetype提示样式,还可以选择:

get_hinting_type()[源代码]

获取用于此特定后端的freetype提示类型。

get_results(box)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

set_canvas_size(w, h, d)[源代码]

设置绘图画布的尺寸。

class matplotlib.mathtext.MathtextBackendAgg[源代码]

基类:matplotlib.mathtext.MathtextBackend

将glyph和矩形渲染到ftimage缓冲区,该缓冲区随后由agg后端传输到agg映像。

get_hinting_type()[源代码]

获取用于此特定后端的freetype提示类型。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

set_canvas_size(w, h, d)[源代码]

设置绘图画布的尺寸。

class matplotlib.mathtext.MathtextBackendBitmap[源代码]

基类:matplotlib.mathtext.MathtextBackendAgg

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

class matplotlib.mathtext.MathtextBackendCairo[源代码]

基类:matplotlib.mathtext.MathtextBackend

存储信息以将MathText呈现写入cairo后端。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

class matplotlib.mathtext.MathtextBackendPath[源代码]

基类:matplotlib.mathtext.MathtextBackend

存储信息以将MathText呈现写入文本路径机器。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

class matplotlib.mathtext.MathtextBackendPdf[源代码]

基类:matplotlib.mathtext.MathtextBackend

存储信息以将MathText呈现写入PDF后端。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

class matplotlib.mathtext.MathtextBackendPs[源代码]

基类:matplotlib.mathtext.MathtextBackend

存储将数学文本呈现写入PostScript后端的信息。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

class matplotlib.mathtext.MathtextBackendSvg[源代码]

基类:matplotlib.mathtext.MathtextBackend

存储信息以将MathText呈现写入SVG后端。

get_results(box, used_characters)[源代码]

返回后端特定的元组,以便在所有处理完成后返回后端。

render_glyph(ox, oy, info)[源代码]

绘制由描述的标志符号 info 到参考点( oxoy

render_rect_filled(x1, y1, x2, y2)[源代码]

从中绘制实心矩形( x1y1x2y2

class matplotlib.mathtext.NegFil[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.NegFill[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.NegFilll[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.Node[源代码]

基类:object

TeX box模型中的节点。

get_kerning(next)[源代码]
grow()[源代码]

增大一个级别。什么东西能有多大是没有限制的。

render(x, y)[源代码]
shrink()[源代码]

缩小一级。只有三个级别的大小,之后将不再变小。

class matplotlib.mathtext.Parser[源代码]

基类:object

一个基于pyparsing的解析器,用于包含数学表达式的字符串。

原始文本也可能出现在成对文本之外 $ .

语法直接基于tex中的语法,尽管它有几个角。

class State(font_output, font, font_class, fontsize, dpi)[源代码]

基类:object

存储分析器的状态。

根据需要从堆栈中推送和弹出状态,“当前”状态始终位于堆栈顶部。

copy()[源代码]
property font
accent(s, loc, toks)[源代码]
accentprefixed(s, loc, toks)
auto_delim(s, loc, toks)[源代码]
binom(s, loc, toks)[源代码]
c_over_c(s, loc, toks)[源代码]
customspace(s, loc, toks)[源代码]
dfrac(s, loc, toks)[源代码]
end_group(s, loc, toks)[源代码]
font(s, loc, toks)[源代码]
frac(s, loc, toks)[源代码]
function(s, loc, toks)[源代码]
genfrac(s, loc, toks)[源代码]
get_state()[源代码]

得到电流 State 语法分析器的。

group(s, loc, toks)[源代码]
is_between_brackets(s, loc)[源代码]
is_dropsub(nucleus)[源代码]
is_overunder(nucleus)[源代码]
is_slanted(nucleus)[源代码]
main(s, loc, toks)[源代码]
math(s, loc, toks)[源代码]
math_string(s, loc, toks)[源代码]
non_math(s, loc, toks)[源代码]
operatorname(s, loc, toks)[源代码]
overline(s, loc, toks)[源代码]
parse(s, fonts_object, fontsize, dpi)[源代码]

分析表达式 s 使用给定的 fonts_object 对于输出,在给定的 字体大小dpi .

返回的分析树 Node 实例。

pop_state()[源代码]

流行音乐 State 从堆栈中删除。

push_state()[源代码]

推新 State 复制当前状态。

required_group(s, loc, toks)
simple_group(s, loc, toks)
space(s, loc, toks)[源代码]
sqrt(s, loc, toks)[源代码]
start_group(s, loc, toks)[源代码]
subsuper(s, loc, toks)[源代码]
symbol(s, loc, toks)[源代码]
unknown_symbol(s, loc, toks)[源代码]
class matplotlib.mathtext.Rule(width, height, depth, state)[源代码]

基类:matplotlib.mathtext.Box

实心黑色矩形。

它有 宽度深度高度 字段与 Hlist . 但是,如果这些维度中的任何一个是inf,则实际值将通过运行规则直到最里面的封闭框的边界来确定。这被称为“运行维度”。宽度永远不会在 Hlist ;高度和深度从未在 Vlist .

render(x, y, w, h)[源代码]
class matplotlib.mathtext.STIXFontConstants[源代码]

基类:matplotlib.mathtext.FontConstantsBase

delta = 0.05
delta_integral = 0.3
delta_slanted = 0.3
script_space = 0.1
sub2 = 0.6
sup1 = 0.8
class matplotlib.mathtext.STIXSansFontConstants[源代码]

基类:matplotlib.mathtext.FontConstantsBase

delta_integral = 0.3
delta_slanted = 0.6
script_space = 0.05
sup1 = 0.8
class matplotlib.mathtext.Ship[源代码]

基类:object

将框发送到输出一旦它们被设置好,这会将它们发送到输出。

既然盒子可以是盒子里面的盒子里面的盒子,主要的工作就是 Ship 由两个相互递归的例程完成, hlist_outvlist_out ,横穿 Hlist 节点和 Vlist 水平和垂直框内的节点。TEX中用于存储状态的全局变量在这里已经成为成员变量。

static clamp(value)[源代码]
hlist_out(box)[源代码]
vlist_out(box)[源代码]
class matplotlib.mathtext.SsGlue[源代码]

基类:matplotlib.mathtext.Glue

[Deprecated]

笔记

3.3 版后已移除:

class matplotlib.mathtext.StandardPsFonts(default_font_prop)[源代码]

基类:matplotlib.mathtext.Fonts

使用标准PostScript字体渲染到后端

与其他字体类BakomaFont和UnicodeFont不同,这一类需要PS后端。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

basepath = '/tmp/vpy_mat/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/afm'
fontmap = {'cal': 'pzcmi8a', 'rm': 'pncr8a', 'tt': 'pcrr8a', 'it': 'pncri8a', 'sf': 'phvr8a', 'bf': 'pncb8a', None: 'psyr'}
get_kern(font1, fontclass1, sym1, fontsize1, font2, fontclass2, sym2, fontsize2, dpi)[源代码]

获取字体间距 sym1sym2 .

芬太克斯 :Tex字体名称之一:

tt, it, rm, cal, sf, bf or default/regular (non-math)

FordCaseX 待办事项

symX :原始tex形式的符号。例如,“1”、“X”或“Sigma”

芬茨赛克斯 :字体大小(以磅为单位)

dpi :当前每英寸点数

get_underline_thickness(font, fontsize, dpi)[源代码]

获取与给定字体匹配的线条粗细。用作绘制分数或根号等线条的基本单位。

get_xheight(font, fontsize, dpi)[源代码]

获取给定的xheight font字体大小 .

class matplotlib.mathtext.StixFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.UnicodeFonts

Stix字体的字体处理类。

除了unicodefonts提供的内容外,此类还包括:

  • 支持“虚拟字体”,它是在特殊的Unicode代码点(如“黑板”)具有不同字体样式的完整字母数字字符集。
  • 处理StixSizex字体的大小可选字符。
参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

cm_fallback = False
get_sized_alternatives_for_symbol(fontname, sym)[源代码]

如果字体提供同一符号的多个大小,则重写。应返回匹配的符号列表 sym 各种尺寸。表达式渲染器将从此列表中为给定情况选择最合适的大小。

use_cmex = False
class matplotlib.mathtext.StixSansFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.StixFonts

Stix字体的字体处理类(默认使用无衬线字符)。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

class matplotlib.mathtext.SubSuperCluster[源代码]

基类:matplotlib.mathtext.Hlist

这是一个绕过这个事实的黑客,这个代码像TeX一样进行两次解析。这让我们在hlist本身中存储足够的信息,即nucleus、sub和super脚本,这样如果后面有另一个需要附加的脚本,就可以动态地重新配置它。

class matplotlib.mathtext.TruetypeFonts(default_font_prop, mathtext_backend)[源代码]

基类:matplotlib.mathtext.Fonts

所有使用TrueType字体(通过ft2font)的字体设置的通用基类。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

destroy()[源代码]

在对象即将被销毁之前修复任何循环引用。

get_kern(font1, fontclass1, sym1, fontsize1, font2, fontclass2, sym2, fontsize2, dpi)[源代码]

获取字体间距 sym1sym2 .

芬太克斯 :Tex字体名称之一:

tt, it, rm, cal, sf, bf or default/regular (non-math)

FordCaseX 待办事项

symX :原始tex形式的符号。例如,“1”、“X”或“Sigma”

芬茨赛克斯 :字体大小(以磅为单位)

dpi :当前每英寸点数

get_underline_thickness(font, fontsize, dpi)[源代码]

获取与给定字体匹配的线条粗细。用作绘制分数或根号等线条的基本单位。

get_xheight(fontname, fontsize, dpi)[源代码]

获取给定的xheight font字体大小 .

class matplotlib.mathtext.UnicodeFonts(*args, **kwargs)[源代码]

基类:matplotlib.mathtext.TruetypeFonts

用于处理Unicode字体的抽象基类。

虽然某些相当完整的Unicode字体(如Dejavu)在某些情况下可能会工作,但对于一组完整的数学符号,我所知道的唯一Unicode字体是Stix。

当在字体中找不到所需符号时,此类将在bakoma字体上“回退”。

参数:
default_font_prop: `~.font_manager.FontProperties`

默认的非数学字体,或Unicode(通用)字体呈现的基础字体。

mathtext_backend: `MathtextBackend` subclass

渲染实际委托给的后端。

get_sized_alternatives_for_symbol(fontname, sym)[源代码]

如果字体提供同一符号的多个大小,则重写。应返回匹配的符号列表 sym 各种尺寸。表达式渲染器将从此列表中为给定情况选择最合适的大小。

use_cmex = True
class matplotlib.mathtext.VCentered(elements)[源代码]

基类:matplotlib.mathtext.Vlist

创建一个 Vlist 其内容集中在其封闭框中。

class matplotlib.mathtext.Vbox(height, depth)[源代码]

基类:matplotlib.mathtext.Box

只有高度(零宽度)的框。

class matplotlib.mathtext.Vlist(elements, h=0.0, m='additional')[源代码]

基类:matplotlib.mathtext.List

框的垂直列表。

vpack(h=0.0, m='additional', l=inf)[源代码]

计算结果框的尺寸,如果预先指定了其中一个尺寸,则调整胶水。

参数:
h浮点,默认值:0

高度。

m{'exactly','additional'},默认值:'additional'

是否生产高度“精确”的盒子 w 或是一个盒子,里面的东西有自然的高度,再加上 w (“附加”)。

l浮动,默认值:np.inf文件

最大高度。

笔记

默认值生成一个具有内容自然高度的框。

class matplotlib.mathtext.Vrule(state)[源代码]

基类:matplotlib.mathtext.Rule

创建垂直规则的便利类。

matplotlib.mathtext.get_unicode_index(symbol, math=True)[源代码]

返回的整数索引(来自Unicode表) 符号 .

参数:
symbolSTR

单字符(例如'A.g.A.g。

mathbool,默认值:True

如果为False,则始终将其视为单个unicode字符。

matplotlib.mathtext.math_to_image(s, filename_or_obj, prop=None, dpi=None, format=None)[源代码]

给定一个数学表达式,将它在一个紧密剪裁的边界框中渲染为图像文件。

参数:
sSTR

数学表达式。数学部分必须用美元符号括起来。

filename_or_objstr或path like或file like

在何处写入图像数据。

propFontProperties 可选字体属性,可选

文本的大小和样式。

dpi可选浮动

输出dpi。如果未设置,则dpi确定为 Figure.savefig .

format可选的STR

输出格式,例如“svg”、“pdf”、“ps”或“png”。如果未设置,则格式确定为 Figure.savefig .