matplotlib.backends.backend_pdf
¶A PDF matplotlib backend Author: Jouni K Seppänen <jks@iki.fi>
matplotlib.backends.backend_pdf.
FigureCanvas
¶matplotlib.backends.backend_pdf.
FigureCanvasPdf
(figure)[source]¶Bases: matplotlib.backend_bases.FigureCanvasBase
The canvas the figure renders into. Calls the draw and print fig methods, creates the renderers, etc...
Attributes
figure | (matplotlib.figure.Figure ) A high-level Figure instance |
filetypes
= {u'pdf': u'Portable Document Format'}¶fixed_dpi
= 72¶matplotlib.backends.backend_pdf.
FigureManager
¶matplotlib.backends.backend_pdf.
GraphicsContextPdf
(file)[source]¶Bases: matplotlib.backend_bases.GraphicsContextBase
capstyles
= {u'butt': 0, u'projecting': 2, u'round': 1}¶commands
= (((u'_cliprect', u'_clippath'), <function clip_cmd>), ((u'_alpha', u'_forced_alpha', u'_effective_alphas'), <function alpha_cmd>), ((u'_capstyle',), <function capstyle_cmd>), ((u'_fillcolor',), <function fillcolor_cmd>), ((u'_joinstyle',), <function joinstyle_cmd>), ((u'_linewidth',), <function linewidth_cmd>), ((u'_dashes',), <function dash_cmd>), ((u'_rgb',), <function rgb_cmd>), ((u'_hatch', u'_hatch_color'), <function hatch_cmd>))¶delta
(other)[source]¶Copy properties of other into self and return PDF commands needed to transform self into other.
fill
(*args)[source]¶Predicate: does the path need to be filled?
An optional argument can be used to specify an alternative _fillcolor, as needed by RendererPdf.draw_markers.
joinstyles
= {u'bevel': 2, u'miter': 0, u'round': 1}¶matplotlib.backends.backend_pdf.
PdfFile
(filename, metadata=None)[source]¶Bases: object
PDF file object.
dviFontName
(dvifont)[source]¶Given a dvi font object, return a name suitable for Op.selectfont. This registers the font information in self.dviFontInfo if not yet registered.
fontName
(fontprop)[source]¶Select a font based on fontprop and return a name suitable for Op.selectfont. If fontprop is a string, it will be interpreted as the filename of the font.
markerObject
(path, trans, fill, stroke, lw, joinstyle, capstyle)[source]¶Return name of a marker XObject representing the given path.
reserveObject
(name=u'')[source]¶Reserve an ID for an indirect object. The name is used for debugging in case we forget to print out the object with writeObject.
texFontMap
¶matplotlib.backends.backend_pdf.
PdfPages
(filename, keep_empty=True, metadata=None)[source]¶Bases: object
A multi-page PDF file.
Notes
In reality PdfPages
is a thin wrapper around PdfFile
, in
order to avoid confusion when using savefig()
and
forgetting the format argument.
Examples
>>> 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()
Create a new PdfPages object.
Parameters: | filename : str
keep_empty : bool, optional
metadata : dictionary, optional
|
---|
attach_note
(text, positionRect=[-100, -100, 0, 0])[source]¶Add a new text note to the page to be saved next. The optional positionRect specifies the position of the new note on the page. It is outside the page per default to make sure it is invisible on printouts.
infodict
()[source]¶Return a modifiable information dictionary object (see PDF reference section 10.2.1 'Document Information Dictionary').
keep_empty
¶savefig
(figure=None, **kwargs)[source]¶Saves a Figure
to this file as a new page.
Any other keyword arguments are passed to
savefig()
.
Parameters: | figure :
|
---|
matplotlib.backends.backend_pdf.
Reference
(id)[source]¶Bases: object
PDF reference object. Use PdfFile.reserveObject() to create References.
matplotlib.backends.backend_pdf.
RendererPdf
(file, image_dpi, height, width)[source]¶Bases: matplotlib.backend_bases.RendererBase
afm_font_cache
= {}¶draw_path_collection
(gc, master_transform, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position)[source]¶matplotlib.backends.backend_pdf.
Stream
(id, len, file, extra=None, png=None)[source]¶Bases: object
PDF stream object.
This has no pdfRepr method. Instead, call begin(), then output the contents of the stream by calling write(), and finally call end().
id: object id of stream; len: an unused Reference object for the length of the stream, or None (to use a memory buffer); file: a PdfFile; extra: a dictionary of extra key-value pairs to include in the stream header; png: if the data is already png compressed, the decode parameters
compressobj
¶extra
¶file
¶id
¶len
¶pdfFile
¶pos
¶matplotlib.backends.backend_pdf.
Verbatim
(x)[source]¶Bases: object
Store verbatim PDF command content for later inclusion in the stream.