matplotlib 3.5.1

ParametersReturns
get_text_path(self, prop, s, ismath=False)

Parameters

prop : `~matplotlib.font_manager.FontProperties`

The font properties for the text.

s : str

The text to be converted.

ismath : {False, True, "TeX"}

If True, use mathtext parser. If "TeX", use tex for rendering.

Returns

verts : list

A list of numpy arrays containing the x and y coordinates of the vertices.

codes : list

A list of path codes.

Convert text s to path (a tuple of vertices and codes for matplotlib.path.Path).

Examples

from matplotlib.path import Path from matplotlib.textpath import TextToPath from matplotlib.font_manager import FontProperties

fp = FontProperties(family="Humor Sans", style="italic") verts, codes = TextToPath().get_text_path(fp, "ABC") path = Path(verts, codes, closed=False)

Also see TextPath for a more direct way to create a path from a text.

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/textpath.py#73
type: <class 'function'>
Commit: