matplotlib.backends.backend_pgf
¶
-
matplotlib.backends.backend_pgf.
FigureCanvas
¶
-
class
matplotlib.backends.backend_pgf.
FigureCanvasPgf
(figure)[源代码]¶ 基类:
matplotlib.backend_bases.FigureCanvasBase
-
filetypes
= {'pdf': 'LaTeX compiled PGF picture', 'pgf': 'LaTeX PGF picture', 'png': 'Portable Network Graphics'}¶
-
get_default_filetype
()[源代码]¶ 返回中指定的默认savefig文件格式
rcParams["savefig.format"]
(default:'png'
) .返回的字符串不包含句点。此方法在仅支持单一文件类型的后端中被重写。
-
-
class
matplotlib.backends.backend_pgf.
GraphicsContextPgf
[源代码]¶ 基类:
matplotlib.backend_bases.GraphicsContextBase
[Deprecated]
笔记
3.3 版后已移除:
-
class
matplotlib.backends.backend_pgf.
LatexManager
[源代码]¶ 基类:
object
LatexManager打开一个LaTeX应用程序实例,用于确定文本元素的度量。可以通过在中设置字体和/或自定义前导来修改LaTeX环境
rcParams
.
-
class
matplotlib.backends.backend_pgf.
PdfPages
(filename, *, keep_empty=True, metadata=None)[源代码]¶ 基类:
object
使用PGF后端的多页PDF文件
实例
>>> import matplotlib.pyplot as plt >>> # Initialize: >>> with PdfPages('foo.pdf') as pdf: ... # As many times as you like, create a figure fig and save it: ... fig = plt.figure() ... pdf.savefig(fig) ... # When no figure is specified the current figure is saved ... pdf.savefig()
创建新的pdfpages对象。
参数: - filenamestr或path-like
情节利用
PdfPages.savefig
将写入此位置的文件。任何同名的旧文件都将被覆盖。- keep_emptybool,默认值:True
如果设置为false,则关闭时将自动删除空的PDF文件。
- metadata可选的
信息字典对象(参见PDF参考第10.2.1节“文档信息字典”),例如:
{{'Creator': 'My software', 'Author': 'Me', 'Title': 'Awesome'}}
.标准键是“Title”、“Author”、“Subject”、“Keywords”、“Creator”、“Producer”、“CreationDate”、“ModDate”和“Trapped”。已经为“Creator”、“Producer”和“CreationDate”预定义了值。可以通过将其设置为
None
.
-
keep_empty
¶
-
property
metadata
¶
-
class
matplotlib.backends.backend_pgf.
RendererPgf
(figure, fh, dummy=<deprecated parameter>)[源代码]¶ 基类:
matplotlib.backend_bases.RendererBase
创建一个新的PGF渲染器,将任何绘图指令转换为文本命令,以便在latex pgfpicture环境中进行解释。
属性: - 图形 :
matplotlib.figure.Figure
matplotlib.figure.Figure
Matplotlib图初始化高度、宽度和dpi。
- fh类文件
图形命令输出的文件句柄。
-
draw_image
(gc, x, y, im, transform=None)[源代码]¶ 绘制RGBA图像。
参数: - gc :
GraphicsContextBase
GraphicsContextBase
包含剪辑信息的图形上下文。
- x标量
距离画布左侧的物理单位(即点或像素)。
- y标量
以物理单位(即点或像素)表示的与画布底部的距离。
- im类数组,shape=(N,M,4),数据类型=np.uint8公司
一组rgba像素。
- 转型 :
matplotlib.transforms.Affine2DBase
matplotlib.transforms.Affine2DBase
如果并且仅当具体的后端被写为
option_scale_image()
收益率True
,仿射变换(即Affine2DBase
) may 被传授给draw_image()
. 变换的平移向量以物理单位(即点或像素)给出。请注意,转换不会重写 x 和 y ,必须应用 之前 将结果转换为 x 和 y (这可以通过添加 x 和 y 到由定义的翻译矢量 转型 )
- gc :
-
draw_markers
(gc, marker_path, marker_trans, path, trans, rgbFace=None)[源代码]¶ 在路径中的每个顶点绘制一个标记。
这包括所有顶点,包括曲线上的控制点。为了避免这种行为,应该在调用此函数之前删除这些顶点。
这提供了一个draw_标记的回退实现,该标记对
draw_path()
. 有些后端可能希望重写此方法,以便只绘制一次标记并多次重复使用它。参数: - gc :
GraphicsContextBase
GraphicsContextBase
图形上下文。
- marker_trans :
matplotlib.transforms.Transform
matplotlib.transforms.Transform
应用于标记的仿射变换。
- 反式 :
matplotlib.transforms.Transform
matplotlib.transforms.Transform
应用于路径的仿射变换。
- gc :
-
draw_text
(gc, x, y, s, prop, angle, ismath=False, mtext=None)[源代码]¶ 绘制文本实例。
参数: - gc :
GraphicsContextBase
GraphicsContextBase
图形上下文。
- x浮动
文本在显示坐标中的x位置。
- y浮动
文本基线在显示坐标中的y位置。
- sSTR
文本字符串。
- prop :
matplotlib.font_manager.FontProperties
matplotlib.font_manager.FontProperties
字体属性。
- angle浮动
以度为单位的逆时针旋转角度。
- 多行文本 :
matplotlib.text.Text
matplotlib.text.Text
要呈现的原始文本对象。
笔记
后端实现者注意:
当您试图确定边界框是否正确时(这是使文本布局/对齐方式正常工作的原因),它有助于更改文本中的线条。py::
if 0: bbox_artist(self, renderer)
如果为1,则实际边界框将与文本一起打印。
- gc :
-
get_text_width_height_descent
(s, prop, ismath)[源代码]¶ Get the width, height, and descent (offset from the bottom to the baseline), in display coords, of the string s with
FontProperties
prop.
-
property
latexManager
¶
-
option_image_nocomposite
()[源代码]¶ 返回是否应跳过Matplotlib合成图像。
栅格后端通常应返回False(让C级栅格化器负责图像合成);矢量后端通常应返回
not rcParams["image.composite_image"]
.
-
option_scale_image
()[源代码]¶ 返回是否在
draw_image()
支持(对于大多数向量后端为真)。
- 图形 :