matplotlib.backends.backend_ps

PostScript后端,可以同时生成PostScript.ps和.eps。

matplotlib.backends.backend_ps.FigureCanvas

alias of matplotlib.backends.backend_ps.FigureCanvasPS

class matplotlib.backends.backend_ps.FigureCanvasPS(figure)[源代码]

基类:matplotlib.backend_bases.FigureCanvasBase

filetypes = {'eps': 'Encapsulated Postscript', 'ps': 'Postscript'}
fixed_dpi = 72
get_default_filetype()[源代码]

返回中指定的默认savefig文件格式 rcParams["savefig.format"] (default: 'png') .

返回的字符串不包含句点。此方法在仅支持单一文件类型的后端中被重写。

print_eps(outfile, *args, **kwargs)[源代码]
print_ps(outfile, *args, **kwargs)[源代码]
class matplotlib.backends.backend_ps.GraphicsContextPS[源代码]

基类:matplotlib.backend_bases.GraphicsContextBase

get_capstyle()[源代码]

在('butt','round','projecting')中以字符串形式返回capstyle。

get_joinstyle()[源代码]

将线条连接样式作为('miter','round','bevel')之一返回。

class matplotlib.backends.backend_ps.PsBackendHelper[源代码]

基类:object

class matplotlib.backends.backend_ps.RendererPS(width, height, pswriter, imagedpi=72)[源代码]

基类:matplotlib.backends._backend_pdf_ps.RendererPDFPSBase

渲染器使用控制颜色/样式的图形上下文实例来处理所有图形基元。

create_hatch(hatch)[源代码]
draw_gouraud_triangle(gc, points, colors, trans)[源代码]

画一个古鲁德阴影三角形。

参数:
gcGraphicsContextBaseGraphicsContextBase

图形上下文。

points类数组,形状=(3,2)

三角形的(x,y)点数组。

colors类数组,形状=(3,4)

三角形每个点的rgba颜色。

转型matplotlib.transforms.Transformmatplotlib.transforms.Transform

应用于点的仿射变换。

draw_gouraud_triangles(gc, points, colors, trans)[源代码]

画一系列的古劳德三角形。

参数:
points类数组,形状=(N,3,2)

数组 N (x,y)三角形的点。

colors类数组,形状=(N,3,4)

数组 N 每个三角形点的rgba颜色。

转型matplotlib.transforms.Transformmatplotlib.transforms.Transform

应用于点的仿射变换。

draw_image(gc, x, y, im, transform=None)[源代码]

绘制RGBA图像。

参数:
gcGraphicsContextBaseGraphicsContextBase

包含剪辑信息的图形上下文。

x标量

距离画布左侧的物理单位(即点或像素)。

y标量

以物理单位(即点或像素)表示的与画布底部的距离。

im类数组,shape=(N,M,4),数据类型=np.uint8公司

一组rgba像素。

转型matplotlib.transforms.Affine2DBasematplotlib.transforms.Affine2DBase

如果并且仅当具体的后端被写为 option_scale_image() 收益率 True ,仿射变换(即 Affine2DBasemay 被传授给 draw_image() . 变换的平移向量以物理单位(即点或像素)给出。请注意,转换不会重写 xy ,必须应用 之前 将结果转换为 xy (这可以通过添加 xy 到由定义的翻译矢量 转型

draw_markers(gc, marker_path, marker_trans, path, trans, rgbFace=None)[源代码]

在路径中的每个顶点绘制一个标记。

这包括所有顶点,包括曲线上的控制点。为了避免这种行为,应该在调用此函数之前删除这些顶点。

这提供了一个draw_标记的回退实现,该标记对 draw_path() . 有些后端可能希望重写此方法,以便只绘制一次标记并多次重复使用它。

参数:
gcGraphicsContextBaseGraphicsContextBase

图形上下文。

marker_transmatplotlib.transforms.Transformmatplotlib.transforms.Transform

应用于标记的仿射变换。

反式matplotlib.transforms.Transformmatplotlib.transforms.Transform

应用于路径的仿射变换。

draw_mathtext(gc, x, y, s, prop, angle)[源代码]

使用绘制数学文本matplotlib.mathtext.

draw_path(gc, path, transform, rgbFace=None)[源代码]

画一个 Path 使用给定仿射变换的实例。

draw_path_collection(gc, master_transform, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position)[源代码]

从列表中选择图形特性绘制路径集合 脸色绿色染料线宽度直线运动抗混叠剂 . 偏移量 是要应用于每个路径的偏移列表。中的偏移量 偏移量 首先被 抵销交易 在应用之前。

offset_position 可以是“屏幕”或“数据”,具体取决于偏移所处的空间;“数据”已弃用。

这提供了 draw_path_collection() 打了多次电话给 draw_path() . 有些后端可能希望重写此项,以便只渲染一次每个路径数据集,然后使用不同的偏移量、颜色、样式等多次引用该路径。生成器方法 _iter_collection_raw_paths()_iter_collection() 旨在帮助(和标准化)跨后端的实现。强烈建议使用这些生成器,以便更改 draw_path_collection() 可以在全球范围内生产。

draw_tex(gc, x, y, s, prop, angle, ismath=<deprecated parameter>, mtext=None)[源代码]
draw_text(gc, x, y, s, prop, angle, ismath=False, mtext=None)[源代码]

绘制文本实例。

参数:
gcGraphicsContextBaseGraphicsContextBase

图形上下文。

x浮动

文本在显示坐标中的x位置。

y浮动

文本基线在显示坐标中的y位置。

sSTR

文本字符串。

propmatplotlib.font_manager.FontPropertiesmatplotlib.font_manager.FontProperties

字体属性。

angle浮动

以度为单位的逆时针旋转角度。

多行文本matplotlib.text.Textmatplotlib.text.Text

要呈现的原始文本对象。

笔记

后端实现者注意:

当您试图确定边界框是否正确时(这是使文本布局/对齐方式正常工作的原因),它有助于更改文本中的线条。py::

if 0: bbox_artist(self, renderer)

如果为1,则实际边界框将与文本一起打印。

get_image_magnification()[源代码]

获取放大传递给绘制图像的图像的因子。允许后端具有与其他艺术家不同分辨率的图像。

merge_used_characters(*args, **kwargs)[源代码]

[Deprecated]

笔记

3.3 版后已移除:

new_gc()[源代码]

返回的实例 GraphicsContextBase .

set_color(r, g, b, store=True)[源代码]
set_font(fontname, fontsize, store=True)[源代码]
set_linecap(linecap, store=True)[源代码]
set_linedash(offset, seq, store=True)[源代码]
set_linejoin(linejoin, store=True)[源代码]
set_linewidth(linewidth, store=True)[源代码]
track_characters(*args, **kwargs)[源代码]

[Deprecated] 跟踪每个字体需要哪些字符。

笔记

3.3 版后已移除.

property used_characters
matplotlib.backends.backend_ps.convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble, paper_width, paper_height, orientation)[源代码]

当我们想在PostScript中使用LaTex后端时,我们将psfrag标记写入一个临时PostScript文件,每个文件都标记了LaTex渲染某些文本的位置。convert psfrags生成一个包含将这些标记转换为文本的命令的 Latex 文档。 Latex /dvips生成包含实际文本的PostScript文件。

matplotlib.backends.backend_ps.get_bbox_header(lbrt, rotated=False)[源代码]

返回给定bbox lbrt=(l,b,r,t)的postscript头字符串。(可选)返回rotate命令。

matplotlib.backends.backend_ps.gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False)[源代码]

使用ghostscript的pswrite或epswrite设备提取文件。这将生成较小的文件,而不使用非法的封装PostScript运算符。输出是低级的,将文本转换为大纲。

matplotlib.backends.backend_ps.pstoeps(tmpfile, bbox=None, rotated=False)[源代码]

将PostScript转换为封装的PostScript。EPS文件的bbox将替换为给定的 bbox 参数。如果没有,将使用原始bbox。

matplotlib.backends.backend_ps.quote_ps_string(s)[源代码]

在PostScript字符串常量中引用s的危险字符。

matplotlib.backends.backend_ps.xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False)[源代码]

使用ghostscript的ps2pdf和xpdf的/poppler的pdftops提取文件。这将生成较小的文件,而不使用非法的封装PostScript运算符。最好使用此蒸馏器,生成将文本视为文本的高级PostScript输出。