MCPcopy Create free account
hub / github.com/ColdGrub1384/Pyto / __init__

Method __init__

site-packages/matplotlib/textpath.py:417–483  ·  view source on GitHub ↗

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

(self, xy, s, size=None, prop=None,
                 _interpolation_steps=1, usetex=False,
                 *kl, **kwargs)

Source from the content-addressed store, hash-verified

415 """
416
417 def __init__(self, xy, s, size=None, prop=None,
418 _interpolation_steps=1, usetex=False,
419 *kl, **kwargs):
420 r"""
421 Create a path from the text. Note that it simply is a path,
422 not an artist. You need to use the `~.PathPatch` (or other artists)
423 to draw this path onto the canvas.
424
425 Parameters
426 ----------
427
428 xy : tuple or array of two float values
429 Position of the text. For no offset, use ``xy=(0, 0)``.
430
431 s : str
432 The text to convert to a path.
433
434 size : float, optional
435 Font size in points. Defaults to the size specified via the font
436 properties *prop*.
437
438 prop : `matplotlib.font_manager.FontProperties`, optional
439 Font property. If not provided, will use a default
440 ``FontProperties`` with parameters from the
441 :ref:`rcParams <matplotlib-rcparams>`.
442
443 _interpolation_steps : integer, optional
444 (Currently ignored)
445
446 usetex : bool, optional
447 Whether to use tex rendering. Defaults to ``False``.
448
449 Examples
450 --------
451
452 The following creates a path from the string "ABC" with Helvetica
453 font face; and another path from the latex fraction 1/2::
454
455 from matplotlib.textpath import TextPath
456 from matplotlib.font_manager import FontProperties
457
458 fp = FontProperties(family="Helvetica", style="italic")
459 path1 = TextPath((12,12), "ABC", size=12, prop=fp)
460 path2 = TextPath((0,0), r"$\frac{1}{2}$", size=12, usetex=True)
461
462 Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`.
463 """
464
465 if prop is None:
466 prop = FontProperties()
467
468 if size is None:
469 size = prop.get_size_in_points()
470
471 self._xy = xy
472 self.set_size(size)
473
474 self._cached_vertices = None

Callers

nothing calls this directly

Calls 4

get_size_in_pointsMethod · 0.95
set_sizeMethod · 0.95
FontPropertiesClass · 0.90

Tested by

no test coverage detected