r""" Create a path from the text. Note that it simply is a path, not an artist. You need to use the `.PathPatch` (or other artists) to draw this path onto the canvas. Parameters ---------- xy : tuple or array of two float values Position o
(self, xy, s, size=None, prop=None,
_interpolation_steps=1, usetex=False)
| 275 | """ |
| 276 | |
| 277 | def __init__(self, xy, s, size=None, prop=None, |
| 278 | _interpolation_steps=1, usetex=False): |
| 279 | r""" |
| 280 | Create a path from the text. Note that it simply is a path, |
| 281 | not an artist. You need to use the `.PathPatch` (or other artists) |
| 282 | to draw this path onto the canvas. |
| 283 | |
| 284 | Parameters |
| 285 | ---------- |
| 286 | xy : tuple or array of two float values |
| 287 | Position of the text. For no offset, use ``xy=(0, 0)``. |
| 288 | |
| 289 | s : str |
| 290 | The text to convert to a path. |
| 291 | |
| 292 | size : float, optional |
| 293 | Font size in points. Defaults to the size specified via the font |
| 294 | properties *prop*. |
| 295 | |
| 296 | prop : `~matplotlib.font_manager.FontProperties`, optional |
| 297 | Font property. If not provided, will use a default |
| 298 | `.FontProperties` with parameters from the |
| 299 | :ref:`rcParams<customizing-with-dynamic-rc-settings>`. |
| 300 | |
| 301 | _interpolation_steps : int, optional |
| 302 | (Currently ignored) |
| 303 | |
| 304 | usetex : bool, default: False |
| 305 | Whether to use tex rendering. |
| 306 | |
| 307 | Examples |
| 308 | -------- |
| 309 | The following creates a path from the string "ABC" with Helvetica |
| 310 | font face; and another path from the latex fraction 1/2:: |
| 311 | |
| 312 | from matplotlib.text import TextPath |
| 313 | from matplotlib.font_manager import FontProperties |
| 314 | |
| 315 | fp = FontProperties(family="Helvetica", style="italic") |
| 316 | path1 = TextPath((12, 12), "ABC", size=12, prop=fp) |
| 317 | path2 = TextPath((0, 0), r"$\frac{1}{2}$", size=12, usetex=True) |
| 318 | |
| 319 | Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`. |
| 320 | """ |
| 321 | # Circular import. |
| 322 | from matplotlib.text import Text |
| 323 | |
| 324 | prop = FontProperties._from_any(prop) |
| 325 | if size is None: |
| 326 | size = prop.get_size_in_points() |
| 327 | |
| 328 | self._xy = xy |
| 329 | self.set_size(size) |
| 330 | |
| 331 | self._cached_vertices = None |
| 332 | s, ismath = Text(usetex=usetex)._preprocess_math(s) |
| 333 | super().__init__( |
| 334 | *text_to_path.get_text_path(prop, s, ismath=ismath), |
nothing calls this directly
no test coverage detected