MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _set_mathtext_path

Method _set_mathtext_path

lib/matplotlib/markers.py:483–505  ·  view source on GitHub ↗

Draw mathtext markers '$...$' using `.TextPath` object. Submitted by tcb

(self)

Source from the content-addressed store, hash-verified

481 self._transform = Affine2D().scale(0.5).rotate_deg(rotation)
482
483 def _set_mathtext_path(self):
484 """
485 Draw mathtext markers '$...$' using `.TextPath` object.
486
487 Submitted by tcb
488 """
489 from matplotlib.text import TextPath
490
491 # again, the properties could be initialised just once outside
492 # this function
493 text = TextPath(xy=(0, 0), s=self.get_marker(),
494 usetex=mpl.rcParams['text.usetex'])
495 if len(text.vertices) == 0:
496 return
497
498 bbox = text.get_extents()
499 max_dim = max(bbox.width, bbox.height)
500 self._transform = (
501 Affine2D()
502 .translate(-bbox.xmin + 0.5 * -bbox.width, -bbox.ymin + 0.5 * -bbox.height)
503 .scale(1.0 / max_dim))
504 self._path = text
505 self._snap = False
506
507 def _half_fill(self):
508 return self.get_fillstyle() in self._half_fillstyles

Callers

nothing calls this directly

Calls 6

get_markerMethod · 0.95
TextPathClass · 0.90
Affine2DClass · 0.85
translateMethod · 0.80
get_extentsMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected