Closed
Description
Bug report
Bug summary
I guess the minimal code-example tells it all...
Code for reproduction
import matplotlib.pyplot as plt
f, ax = plt.subplots()
ax.text(1, 2, "$$")
Actual outcome
Out[1]: Text(1, 2, '$$')Traceback (most recent call last):
File " ...\lib\site-packages\matplotlib\_mathtext.py", line 2277, in parse
result = self._expression.parseString(s)
File " ...\lib\site-packages\pyparsing.py", line 1955, in parseString
raise exc
File " ...\lib\site-packages\pyparsing.py", line 3814, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text, found '$' (at char 0), (line:1, col:1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File " ...\lib\site-packages\matplotlib\backends\backend_qt5.py", line 475, in _draw_idle
self.draw()
File " ...\lib\site-packages\matplotlib\backends\backend_agg.py", line 406, in draw
self.figure.draw(self.renderer)
File " ...\lib\site-packages\matplotlib\artist.py", line 74, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File " ...\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File " ...\lib\site-packages\matplotlib\figure.py", line 2780, in draw
mimage._draw_list_compositing_images(
File " ...\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File " ...\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File " ...\lib\site-packages\matplotlib\_api\deprecation.py", line 431, in wrapper
return func(*inner_args, **inner_kwargs)
File " ...\lib\site-packages\matplotlib\axes\_base.py", line 2921, in draw
mimage._draw_list_compositing_images(renderer, self, artists)
File " ...\lib\site-packages\matplotlib\image.py", line 132, in _draw_list_compositing_images
a.draw(renderer)
File " ...\lib\site-packages\matplotlib\artist.py", line 51, in draw_wrapper
return draw(artist, renderer, *args, **kwargs)
File " ...\lib\site-packages\matplotlib\text.py", line 679, in draw
bbox, info, descent = textobj._get_layout(renderer)
File " ...\lib\site-packages\matplotlib\text.py", line 314, in _get_layout
w, h, d = renderer.get_text_width_height_descent(
File " ...\lib\site-packages\matplotlib\backends\backend_agg.py", line 235, in get_text_width_height_descent
self.mathtext_parser.parse(s, self.dpi, prop)
File " ...\lib\site-packages\matplotlib\mathtext.py", line 452, in parse
return self._parse_cached(s, dpi, prop, _force_standard_ps_fonts)
File " ...\lib\site-packages\matplotlib\mathtext.py", line 473, in _parse_cached
box = self._parser.parse(s, font_output, fontsize, dpi)
File " ...\lib\site-packages\matplotlib\_mathtext.py", line 2279, in parse
raise ValueError("\n".join(["",
ValueError:
$$
^
Expected end of text, found '$' (at char 0), (line:1, col:1)
Expected outcome
Matplotlib version
- Operating system: Windows 10
- Matplotlib version: 3.4.2
- Matplotlib backend: QT5Agg
- Python version: 3.8.8
- Jupyter version (if applicable): -
- Other libraries: -
conda install -c conda-forge matplotlib