<divid="unreleased-message"> You are reading an old version of the documentation (v3.3.2). For the latest version see <ahref="https://matplotlib.org/stable/api/textpath_api.html">https://matplotlib.org/stable/api/textpath_api.html</a></div>
<spanid="matplotlib-textpath"></span><h1><codeclass="docutils literal notranslate"><spanclass="pre">matplotlib.textpath</span></code><aclass="headerlink" href="#module-matplotlib.textpath" title="Permalink to this headline">¶</a></h1>
<dlclass="py class">
<dtid="matplotlib.textpath.TextPath">
<emclass="property">class </em><codeclass="descclassname">matplotlib.textpath.</code><codeclass="descname">TextPath</code><spanclass="sig-paren">(</span><em><spanclass="n">xy</span></em>, <em><spanclass="n">s</span></em>, <em><spanclass="n">size</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">prop</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <em><spanclass="n">_interpolation_steps</span><spanclass="o">=</span><spanclass="default_value">1</span></em>, <em><spanclass="n">usetex</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/textpath.html#TextPath"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.textpath.TextPath" title="Permalink to this definition">¶</a></dt>
<p>Create a path from the text. Note that it simply is a path,
not an artist. You need to use the <aclass="reference internal" href="_as_gen/matplotlib.patches.PathPatch.html#matplotlib.patches.PathPatch" title="matplotlib.patches.PathPatch"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">PathPatch</span></code></a> (or other artists)
<trclass="field-odd field"><thclass="field-name">Parameters:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>xy</strong><spanclass="classifier">tuple or array of two float values</span></dt><dd><p>Position of the text. For no offset, use <codeclass="docutils literal notranslate"><spanclass="pre">xy=(0,</span><spanclass="pre">0)</span></code>.</p>
</dd>
<dt><strong>s</strong><spanclass="classifier">str</span></dt><dd><p>The text to convert to a path.</p>
</dd>
<dt><strong>size</strong><spanclass="classifier">float, optional</span></dt><dd><p>Font size in points. Defaults to the size specified via the font
properties <em>prop</em>.</p>
</dd>
<dt><strong>prop</strong><spanclass="classifier"><aclass="reference internal" href="font_manager_api.html#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">matplotlib.font_manager.FontProperties</span></code></a>, optional</span></dt><dd><p>Font property. If not provided, will use a default
<codeclass="docutils literal notranslate"><spanclass="pre">FontProperties</span></code> with parameters from the
<p>Also see <aclass="reference internal" href="../gallery/text_labels_and_annotations/demo_text_path.html"><spanclass="doc">Demo Text Path</span></a>.</p>
<dlclass="py method">
<dtid="matplotlib.textpath.TextPath.codes">
<emclass="property">property </em><codeclass="descname">codes</code><aclass="headerlink" href="#matplotlib.textpath.TextPath.codes" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the codes</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.textpath.TextPath.get_size">
<codeclass="descname">get_size</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/textpath.html#TextPath.get_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.textpath.TextPath.get_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the text size.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.textpath.TextPath.set_size">
<codeclass="descname">set_size</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em>, <em><spanclass="n">size</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/textpath.html#TextPath.set_size"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.textpath.TextPath.set_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the text size.</p>
</dd></dl>
<dlclass="py method">
<dtid="matplotlib.textpath.TextPath.vertices">
<emclass="property">property </em><codeclass="descname">vertices</code><aclass="headerlink" href="#matplotlib.textpath.TextPath.vertices" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the cached path after updating it if necessary.</p>
</dd></dl>
</dd></dl>
<dlclass="py class">
<dtid="matplotlib.textpath.TextToPath">
<emclass="property">class </em><codeclass="descclassname">matplotlib.textpath.</code><codeclass="descname">TextToPath</code><aclass="reference internal" href="../_modules/matplotlib/textpath.html#TextToPath"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.textpath.TextToPath" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">DPI</code><emclass="property"> = 72</em><aclass="headerlink" href="#matplotlib.textpath.TextToPath.DPI" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">FONT_SCALE</code><emclass="property"> = 100.0</em><aclass="headerlink" href="#matplotlib.textpath.TextToPath.FONT_SCALE" title="Permalink to this definition">¶</a></dt>
<codeclass="descname">get_texmanager</code><spanclass="sig-paren">(</span><em><spanclass="n">self</span></em><spanclass="sig-paren">)</span><aclass="reference internal" href="../_modules/matplotlib/textpath.html#TextToPath.get_texmanager"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink" href="#matplotlib.textpath.TextToPath.get_texmanager" title="Permalink to this definition">¶</a></dt>
<dt><strong>prop</strong><spanclass="classifier"><aclass="reference internal" href="font_manager_api.html#matplotlib.font_manager.FontProperties" title="matplotlib.font_manager.FontProperties"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">FontProperties</span></code></a></span></dt><dd><p>The font properties for the text.</p>
</dd>
<dt><strong>s</strong><spanclass="classifier">str</span></dt><dd><p>The text to be converted.</p>
</dd>
<dt><strong>ismath</strong><spanclass="classifier">{False, True, "TeX"}</span></dt><dd><p>If True, use mathtext parser. If "TeX", use tex for rendering.</p>
</dd>
</dl>
</td>
</tr>
<trclass="field-even field"><thclass="field-name">Returns:</th><tdclass="field-body"><dlclass="first last docutils">
<dt><strong>verts</strong><spanclass="classifier">list</span></dt><dd><p>A list of numpy arrays containing the x and y coordinates of the
vertices.</p>
</dd>
<dt><strong>codes</strong><spanclass="classifier">list</span></dt><dd><p>A list of path codes.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
<pclass="rubric">Examples</p>
<p>Create a list of vertices and codes from a text, and create 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>
<p>Also see <aclass="reference internal" href="#matplotlib.textpath.TextPath" title="matplotlib.textpath.TextPath"><codeclass="xref py py-obj docutils literal notranslate"><spanclass="pre">TextPath</span></code></a> for a more direct way to create a path from a text.</p>