matplotlib.backends.backend_agg#
An Anti-Grain Geometry (AGG) backend.
Features that are implemented:
capstyles and join styles
dashes
linewidth
lines, rectangles, ellipses
clipping to a rectangle
output to RGBA and Pillow-supported image formats
alpha blending
DPI scaling properly - everything scales properly (dashes, linewidths, etc)
draw polygon
freetype2 w/ ft2font
Still TODO:
integrate screen dpi w/ ppi and text
- matplotlib.backends.backend_agg.FigureCanvas[source]#
alias of
FigureCanvasAgg
- class matplotlib.backends.backend_agg.FigureCanvasAgg(figure=None)[source]#
Bases:
FigureCanvasBase- buffer_rgba()[source]#
Get the image as a
memoryviewto the renderer's buffer.drawmust be called at least once before this function will work and to update the renderer for any subsequent changes to the Figure.
- draw()[source]#
Render the
Figure.This method must walk the artist tree, even if no output is produced, because it triggers deferred work that users may want to access before saving output to disk. For example computing limits, auto-limits, and tick values.
- print_jpeg(filename_or_obj, *, metadata=None, pil_kwargs=None)[source]#
Write the figure to a JPEG file.
- Parameters:
- filename_or_objstr or path-like or file-like
The file to write to.
- pil_kwargsdict, optional
Additional keyword arguments that are passed to
PIL.Image.Image.savewhen saving the figure.
- print_jpg(filename_or_obj, *, metadata=None, pil_kwargs=None)[source]#
Write the figure to a JPEG file.
- Parameters:
- filename_or_objstr or path-like or file-like
The file to write to.
- pil_kwargsdict, optional
Additional keyword arguments that are passed to
PIL.Image.Image.savewhen saving the figure.
- print_png(filename_or_obj, *, metadata=None, pil_kwargs=None)[source]#
Write the figure to a PNG file.
- Parameters:
- filename_or_objstr or path-like or file-like
The file to write to.
- metadatadict, optional
Metadata in the PNG file as key-value pairs of bytes or latin-1 encodable strings. According to the PNG specification, keys must be shorter than 79 chars.
The PNG specification defines some common keywords that may be used as appropriate:
Title: Short (one line) title or caption for image.
Author: Name of image's creator.
Description: Description of image (possibly long).
Copyright: Copyright notice.
Creation Time: Time of original image creation (usually RFC 1123 format).
Software: Software used to create the image.
Disclaimer: Legal disclaimer.
Warning: Warning of nature of content.