<divid="unreleased-message"> You are reading an old version of the documentation (v2.2.4). For the latest version see <ahref="https://matplotlib.org/stable/api/backend_agg_api.html">https://matplotlib.org/stable/api/backend_agg_api.html</a></div>
<codeclass="descclassname">matplotlib.backends.backend_agg.</code><codeclass="descname">FigureCanvas</code><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvas" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.backends.backend_agg.</code><codeclass="descname">FigureCanvasAgg</code><spanclass="sig-paren">(</span><em>figure</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">buffer_rgba</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.buffer_rgba"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.buffer_rgba" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the image as an RGBA byte string</p>
<p><aclass="reference internal" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.draw" title="matplotlib.backends.backend_agg.FigureCanvasAgg.draw"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">draw</span></code></a> must be called at least once before this function will work and
to update the renderer for any subsequent changes to the Figure.</p>
<codeclass="descname">copy_from_bbox</code><spanclass="sig-paren">(</span><em>bbox</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.copy_from_bbox"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.copy_from_bbox" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">draw</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.draw"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.draw" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_renderer</code><spanclass="sig-paren">(</span><em>cleared=False</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.get_renderer"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.get_renderer" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_jpeg</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_jpeg" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_jpg</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.print_jpg"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_jpg" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_png</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.print_png"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_png" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_raw</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.print_raw"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_raw" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_rgba</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_rgba" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_tif</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.print_tif"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_tif" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_tiff</code><spanclass="sig-paren">(</span><em>filename_or_obj</em>, <em>*args</em>, <em>**kwargs</em><spanclass="sig-paren">)</span><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_tiff" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">print_to_buffer</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.print_to_buffer"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.print_to_buffer" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">restore_region</code><spanclass="sig-paren">(</span><em>region</em>, <em>bbox=None</em>, <em>xy=None</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.restore_region"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.restore_region" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tostring_argb</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.tostring_argb"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.tostring_argb" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the image as an ARGB byte string</p>
<p><aclass="reference internal" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.draw" title="matplotlib.backends.backend_agg.FigureCanvasAgg.draw"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">draw</span></code></a> must be called at least once before this function will work and
to update the renderer for any subsequent changes to the Figure.</p>
<codeclass="descname">tostring_rgb</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#FigureCanvasAgg.tostring_rgb"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.tostring_rgb" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the image as an RGB byte string</p>
<p><aclass="reference internal" href="#matplotlib.backends.backend_agg.FigureCanvasAgg.draw" title="matplotlib.backends.backend_agg.FigureCanvasAgg.draw"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">draw</span></code></a> must be called at least once before this function will work and
to update the renderer for any subsequent changes to the Figure.</p>
<codeclass="descname">buffer_rgba</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.buffer_rgba"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.buffer_rgba" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">clear</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.clear"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.clear" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">debug</code><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.debug" title="Permalink to this definition">¶</a></dt>
<dd><divclass="deprecated">
<p><spanclass="versionmodified">Deprecated since version 2.2: </span>The debug function was deprecated in version 2.2.</p>
<codeclass="descname">draw_markers</code><spanclass="sig-paren">(</span><em>*kl</em>, <em>**kw</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.draw_markers"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.draw_markers" title="Permalink to this definition">¶</a></dt>
<dd><p>Draws a marker at each of the vertices in path. This includes
all vertices, including control points on curves. To avoid
that behavior, those vertices should be removed before calling
this function.</p>
<p>This provides a fallback implementation of draw_markers that
makes multiple calls to <aclass="reference internal" href="#matplotlib.backends.backend_agg.RendererAgg.draw_path" title="matplotlib.backends.backend_agg.RendererAgg.draw_path"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">draw_path()</span></code></a>. Some backends may
want to override this method in order to draw the marker only
<codeclass="descname">draw_path_collection</code><spanclass="sig-paren">(</span><em>*kl</em>, <em>**kw</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.draw_path_collection"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.draw_path_collection" title="Permalink to this definition">¶</a></dt>
<dd><p>Draws a collection of paths selecting drawing properties from
the lists <em>facecolors</em>, <em>edgecolors</em>, <em>linewidths</em>,
<em>linestyles</em> and <em>antialiaseds</em>. <em>offsets</em> is a list of
offsets to apply to each of the paths. The offsets in
<em>offsets</em> are first transformed by <em>offsetTrans</em> before being
applied. <em>offset_position</em> may be either "screen" or "data"
depending on the space that the offsets are in.</p>
<p>This provides a fallback implementation of
<aclass="reference internal" href="#matplotlib.backends.backend_agg.RendererAgg.draw_path_collection" title="matplotlib.backends.backend_agg.RendererAgg.draw_path_collection"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">draw_path_collection()</span></code></a> that makes multiple calls to
<aclass="reference internal" href="#matplotlib.backends.backend_agg.RendererAgg.draw_path" title="matplotlib.backends.backend_agg.RendererAgg.draw_path"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">draw_path()</span></code></a>. Some backends may want to override this in
order to render each set of path data only once, and then
reference that path multiple times with the different offsets,
colors, styles etc. The generator methods
<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">_iter_collection_raw_paths()</span></code> and
<codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">_iter_collection()</span></code> are provided to help with (and
standardize) the implementation across backends. It is highly
recommended to use those generators, so that changes to the
behavior of <aclass="reference internal" href="#matplotlib.backends.backend_agg.RendererAgg.draw_path_collection" title="matplotlib.backends.backend_agg.RendererAgg.draw_path_collection"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">draw_path_collection()</span></code></a> can be made globally.</p>
<codeclass="descname">get_canvas_width_height</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.get_canvas_width_height"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.get_canvas_width_height" title="Permalink to this definition">¶</a></dt>
<dd><p>return the canvas width and height in display coords</p>
<codeclass="descname">get_text_width_height_descent</code><spanclass="sig-paren">(</span><em>s</em>, <em>prop</em>, <em>ismath</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.get_text_width_height_descent"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.get_text_width_height_descent" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the width, height, and descent (offset from the bottom
to the baseline), in display coords, of the string <em>s</em> with
<codeclass="descname">option_image_nocomposite</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.option_image_nocomposite"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.option_image_nocomposite" title="Permalink to this definition">¶</a></dt>
<dd><p>override this method for renderers that do not necessarily always
want to rescale and composite raster images. (like SVG, PDF, or PS)</p>
<codeclass="descname">option_scale_image</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.option_scale_image"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.option_scale_image" title="Permalink to this definition">¶</a></dt>
<dd><p>agg backend doesn't support arbitrary scaling of image.</p>
<codeclass="descname">points_to_pixels</code><spanclass="sig-paren">(</span><em>points</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.points_to_pixels"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.points_to_pixels" title="Permalink to this definition">¶</a></dt>
<dd><p>convert point measures to pixes using dpi and the pixels per
<codeclass="descname">restore_region</code><spanclass="sig-paren">(</span><em>region</em>, <em>bbox=None</em>, <em>xy=None</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.restore_region"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.restore_region" title="Permalink to this definition">¶</a></dt>
<dd><p>Restore the saved region. If bbox (instance of BboxBase, or
its extents) is given, only the region specified by the bbox
will be restored. <em>xy</em> (a tuple of two floasts) optionally
specifies the new position (the LLC of the original region,
not the LLC of the bbox) where the region will be restored.</p>
<codeclass="descname">start_filter</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.start_filter"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.start_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Start filtering. It simply create a new canvas (the old one is saved).</p>
<codeclass="descname">stop_filter</code><spanclass="sig-paren">(</span><em>post_processing</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.stop_filter"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.stop_filter" title="Permalink to this definition">¶</a></dt>
<dd><p>Save the plot in the current canvas as a image and apply
the <em>post_processing</em> function.</p>
<blockquote>
<div><dlclass="docutils">
<dt>def post_processing(image, dpi):</dt>
<dd># ny, nx, depth = image.shape
# image (numpy array) has RGBA channels and has a depth of 4.
...
# create a new_image (numpy array of 4 channels, size can be
# different). The resulting image may have offsets from
# lower-left corner of the original image
return new_image, offset_x, offset_y</dd>
</dl>
</div></blockquote>
<p>The saved renderer is restored and the returned image from
post_processing is plotted (using draw_image) on it.</p>
<codeclass="descname">tostring_argb</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.tostring_argb"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.tostring_argb" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tostring_rgb</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.tostring_rgb"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.tostring_rgb" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">tostring_rgba_minimized</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#RendererAgg.tostring_rgba_minimized"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.RendererAgg.tostring_rgba_minimized" title="Permalink to this definition">¶</a></dt>
<codeclass="descclassname">matplotlib.backends.backend_agg.</code><codeclass="descname">get_hinting_flag</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_agg.html#get_hinting_flag"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_agg.get_hinting_flag" title="Permalink to this definition">¶</a></dt>