Skip to content

Commit 367026f

Browse files
committed
Rename flag, docstrings fixed
1 parent 7ac787a commit 367026f

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lib/matplotlib/text.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def __init__(self,
123123
linespacing=None,
124124
rotation_mode=None,
125125
usetex=None, # defaults to rcParams['text.usetex']
126-
override_math=False,
127126
wrap=False,
128127
transform_rotates_text=False,
128+
parse_math=True,
129129
**kwargs
130130
):
131131
"""
@@ -143,7 +143,7 @@ def __init__(self,
143143
color if color is not None else mpl.rcParams["text.color"])
144144
self.set_fontproperties(fontproperties)
145145
self.set_usetex(usetex)
146-
self.set_override_math(override_math)
146+
self.set_parse_math(parse_math)
147147
self.set_wrap(wrap)
148148
self.set_verticalalignment(verticalalignment)
149149
self.set_horizontalalignment(horizontalalignment)
@@ -1239,7 +1239,7 @@ def _preprocess_math(self, s):
12391239
if s == " ":
12401240
s = r"\ "
12411241
return s, "TeX"
1242-
elif not self.get_override_math() and cbook.is_math_text(s):
1242+
elif self.get_parse_math() and cbook.is_math_text(s):
12431243
return s, True
12441244
else:
12451245
return s.replace(r"\$", "$"), False
@@ -1276,21 +1276,24 @@ def get_usetex(self):
12761276
"""Return whether this `Text` object uses TeX for rendering."""
12771277
return self._usetex
12781278

1279-
def set_override_math(self, override_math):
1279+
def set_parse_math(self, parse_math):
12801280
"""
1281+
Override switch to enable/disable any mathtext
1282+
parsing for the given `Text` object.
1283+
12811284
Parameters
12821285
----------
1283-
override_math : bool
1284-
Whether to override mathtext parsing with the normal parsing
1286+
parse_math : bool
1287+
Whether to consider mathtext parsing for the string
12851288
"""
1286-
self._override_math = bool(override_math)
1289+
self._parse_math = bool(parse_math)
12871290

1288-
def get_override_math(self):
1291+
def get_parse_math(self):
12891292
"""
1290-
Return whether this `Text` object is supposed to
1291-
override mathtext parsing with normal parsing.
1293+
Return whether mathtext parsing is considered
1294+
for this `Text` object.
12921295
"""
1293-
return self._override_math
1296+
return self._parse_math
12941297

12951298
def set_fontname(self, fontname):
12961299
"""

0 commit comments

Comments
 (0)