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

Method is_math_text

site-packages/matplotlib/text.py:1196–1216  ·  view source on GitHub ↗

Returns a cleaned string and a boolean flag. The flag indicates if the given string *s* contains any mathtext, determined by counting unescaped dollar signs. If no mathtext is present, the cleaned string has its dollar signs unescaped. If usetex is on, the fl

(s, usetex=None)

Source from the content-addressed store, hash-verified

1194
1195 @staticmethod
1196 def is_math_text(s, usetex=None):
1197 """
1198 Returns a cleaned string and a boolean flag.
1199 The flag indicates if the given string *s* contains any mathtext,
1200 determined by counting unescaped dollar signs. If no mathtext
1201 is present, the cleaned string has its dollar signs unescaped.
1202 If usetex is on, the flag always has the value "TeX".
1203 """
1204 # Did we find an even number of non-escaped dollar signs?
1205 # If so, treat is as math text.
1206 if usetex is None:
1207 usetex = rcParams['text.usetex']
1208 if usetex:
1209 if s == ' ':
1210 s = r'\ '
1211 return s, 'TeX'
1212
1213 if cbook.is_math_text(s):
1214 return s, True
1215 else:
1216 return s.replace(r'\$', '$'), False
1217
1218 def set_fontproperties(self, fp):
1219 """

Callers 6

_get_layoutMethod · 0.95
drawMethod · 0.45
set_markerMethod · 0.45
get_extentMethod · 0.45
get_label_widthMethod · 0.45

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected