You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to generate some figures using the latex fonts (rc('text', usetex=True)), but I always get an error (I also tried on linux). If I set usetex=False, no error is raised and the figure is properly generated, even the tex characters are generated.
If the figure is not composed by subplots, no error is raised, so, I think is something between subplots and tex.
Traceback (most recent call last):
File "C:\research\accasim-tests\new_model\analysis\tex_error.py", line 52, in <module>
plt.tight_layout()
File "C:\Program Files\Python36\lib\site-packages\matplotlib\pyplot.py", line 1368, in tight_layout
gcf().tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\figure.py", line 2476, in tight_layout
pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\tight_layout.py", line 362, in get_tight_layout_figure
pad=pad, h_pad=h_pad, w_pad=w_pad)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\tight_layout.py", line 111, in auto_adjust_subplotpars
tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots
File "C:\Program Files\Python36\lib\site-packages\matplotlib\tight_layout.py", line 112, in <listcomp>
if ax.get_visible()])
File "C:\Program Files\Python36\lib\site-packages\matplotlib\axes\_base.py", line 4357, in get_tightbbox
bb_xaxis = self.xaxis.get_tightbbox(renderer)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\axis.py", line 1178, in get_tightbbox
*ticklabelBoxes2,
File "C:\Program Files\Python36\lib\site-packages\matplotlib\axis.py", line 1176, in <genexpr>
if a.get_visible()),
File "C:\Program Files\Python36\lib\site-packages\matplotlib\text.py", line 890, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\text.py", line 298, in _get_layout
clean_line, self._fontproperties, ismath=ismath)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\backends\backend_agg.py", line 201, in get_text_width_height_descent
s, fontsize, renderer=self)
File "C:\Program Files\Python36\lib\site-packages\matplotlib\texmanager.py", line 449, in get_text_width_height_descent
with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:
File "C:\Program Files\Python36\lib\site-packages\matplotlib\dviread.py", line 198, in __init__
self.file = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\cgall\\.matplotlib\\tex.cache\\aee1b2d0939944ebcda4231dd9a1549a.dvi'
Actually the problem is unrelated to subplots, but rather to the fact that your xlabel is an empty string (because it starts with a LaTeX comment, "%"). Fixing that, as well as the missing $$ in TEXT_2-B, fixes the issue.
Still, we should handle (effectively) empty latex inputs more cleanly...
Bug report
I was trying to generate some figures using the latex fonts (rc('text', usetex=True)), but I always get an error (I also tried on linux). If I set usetex=False, no error is raised and the figure is properly generated, even the tex characters are generated.
If the figure is not composed by subplots, no error is raised, so, I think is something between subplots and tex.
Code for reproduction
Actual outcome
Matplotlib version
print(matplotlib.get_backend())
): TkAggMatplotlib installed via pip command
The text was updated successfully, but these errors were encountered: