<divid="unreleased-message"> You are reading an old version of the documentation (v3.2.0). For the latest version see <ahref="https://matplotlib.org/stable/api/backend_template_api.html">https://matplotlib.org/stable/api/backend_template_api.html</a></div>
<p>If your backend implements support for saving figures (i.e. has a <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">print_xyz</span></code>
method), you can register it as the default handler for a given file type:</p>
<codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">FigureCanvas</code><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureCanvas" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">FigureCanvasTemplate</code><spanclass="sig-paren">(</span><em>figure</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#FigureCanvasTemplate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureCanvasTemplate" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">draw</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#FigureCanvasTemplate.draw"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureCanvasTemplate.draw" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_default_filetype</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#FigureCanvasTemplate.get_default_filetype"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureCanvasTemplate.get_default_filetype" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the default savefig file format as specified in rcParam
<codeclass="docutils literal notranslate"><spanclass="pre">savefig.format</span></code>. Returned string excludes period. Overridden
in backends that only support a single file type.</p>
<codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">FigureManager</code><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureManager" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">FigureManagerTemplate</code><spanclass="sig-paren">(</span><em>canvas</em>, <em>num</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#FigureManagerTemplate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.FigureManagerTemplate" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">GraphicsContextTemplate</code><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#GraphicsContextTemplate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.GraphicsContextTemplate" title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">RendererTemplate</code><spanclass="sig-paren">(</span><em>dpi</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate" title="Permalink to this definition">¶</a></dt>
<dt><strong>x</strong><spanclass="classifier">scalar</span></dt><dd><p>The distance in physical units (i.e., dots or pixels) from the left
hand side of the canvas.</p>
</dd>
<dt><strong>y</strong><spanclass="classifier">scalar</span></dt><dd><p>The distance in physical units (i.e., dots or pixels) from the
bottom side of the canvas.</p>
</dd>
<dt><strong>im</strong><spanclass="classifier">array-like, shape=(N, M, 4), dtype=np.uint8</span></dt><dd><p>An array of RGBA pixels.</p>
</dd>
<dt><strong>transform</strong><spanclass="classifier"><aclass="reference internal" href="transformations.html#matplotlib.transforms.Affine2DBase" title="matplotlib.transforms.Affine2DBase"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.transforms.Affine2DBase</span></code></a></span></dt><dd><p>If and only if the concrete backend is written such that
transformation <em>may</em> be passed to <aclass="reference internal" href="#matplotlib.backends.backend_template.RendererTemplate.draw_image" title="matplotlib.backends.backend_template.RendererTemplate.draw_image"><codeclass="xref py py-meth docutils literal notranslate"><spanclass="pre">draw_image()</span></code></a>. It takes the
form of a <aclass="reference internal" href="transformations.html#matplotlib.transforms.Affine2DBase" title="matplotlib.transforms.Affine2DBase"><codeclass="xref py py-class docutils literal notranslate"><spanclass="pre">Affine2DBase</span></code></a> instance.
The translation vector of the transformation is given in physical
units (i.e., dots or pixels). Note that the transformation does not
override <em>x</em> and <em>y</em>, and has to be applied <em>before</em> translating
the result by <em>x</em> and <em>y</em> (this can be accomplished by adding <em>x</em>
and <em>y</em> to the translation vector defined by <em>transform</em>).</p>
<codeclass="descname">draw_path</code><spanclass="sig-paren">(</span><em>self</em>, <em>gc</em>, <em>path</em>, <em>transform</em>, <em>rgbFace=None</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate.draw_path"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate.draw_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Draw a <aclass="reference internal" href="path_api.html#matplotlib.path.Path" title="matplotlib.path.Path"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">Path</span></code></a> instance using the given affine transform.</p>
<dt><strong>angle</strong><spanclass="classifier">float</span></dt><dd><p>The rotation angle in degrees anti-clockwise.</p>
</dd>
<dt><strong>mtext</strong><spanclass="classifier"><aclass="reference internal" href="text_api.html#matplotlib.text.Text" title="matplotlib.text.Text"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.text.Text</span></code></a></span></dt><dd><p>The original text object to be rendered.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Notes</p>
<p><strong>Note for backend implementers:</strong></p>
<p>When you are trying to determine if you have gotten your bounding box
right (which is what enables the text layout/alignment to work
properly), it helps to change the line in text.py:</p>
<codeclass="descname">flipy</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate.flipy"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate.flipy" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether y values increase from top to bottom.</p>
<p>Note that this only affects drawing of texts and images.</p>
<codeclass="descname">get_canvas_width_height</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate.get_canvas_width_height"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate.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">new_gc</code><spanclass="sig-paren">(</span><em>self</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate.new_gc"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate.new_gc" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an instance of a <codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">GraphicsContextBase</span></code>.</p>
<codeclass="descname">points_to_pixels</code><spanclass="sig-paren">(</span><em>self</em>, <em>points</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#RendererTemplate.points_to_pixels"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.RendererTemplate.points_to_pixels" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert points to display units.</p>
<p>You need to override this function (unless your backend
doesn't have a dpi, e.g., postscript or svg). Some imaging
systems assume some value for pixels per inch:</p>
<codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">draw_if_interactive</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#draw_if_interactive"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.draw_if_interactive" title="Permalink to this definition">¶</a></dt>
<dd><p>For image backends - is not required.
For GUI backends - this should be overridden if drawing should be done in
<codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">new_figure_manager_given_figure</code><spanclass="sig-paren">(</span><em>num</em>, <em>figure</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#new_figure_manager_given_figure"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.new_figure_manager_given_figure" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new figure manager instance for the given figure.</p>
<codeclass="descclassname">matplotlib.backends.backend_template.</code><codeclass="descname">show</code><spanclass="sig-paren">(</span><em>*</em>, <em>block=None</em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/backends/backend_template.html#show"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.backends.backend_template.show" title="Permalink to this definition">¶</a></dt>
<dd><p>For image backends - is not required.
For GUI backends - show() is usually the last line of a pyplot script and
tells the backend that it is time to draw. In interactive mode, this