René's URL Explorer Experiment


Title: [Bug]: `FigureCanvasPgf` does not use `xelatex` · Issue #28084 · matplotlib/matplotlib · GitHub

Open Graph Title: [Bug]: `FigureCanvasPgf` does not use `xelatex` · Issue #28084 · matplotlib/matplotlib

X Title: [Bug]: `FigureCanvasPgf` does not use `xelatex` · Issue #28084 · matplotlib/matplotlib

Description: Bug summary FigureCanvasPgf does not use xelatex but uses pdflatex. Code for reproduction """ ============ PGF preamble modified from the official example: https://matplotlib.org/stable/users/explain/text/pgf.html#custom-preamble =======...

Open Graph Description: Bug summary FigureCanvasPgf does not use xelatex but uses pdflatex. Code for reproduction """ ============ PGF preamble modified from the official example: https://matplotlib.org/stable/users/expla...

X Description: Bug summary FigureCanvasPgf does not use xelatex but uses pdflatex. Code for reproduction """ ============ PGF preamble modified from the official example: https://matplotlib.org/sta...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/28084

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: `FigureCanvasPgf` does not use `xelatex`","articleBody":"### Bug summary\r\n\r\n`FigureCanvasPgf` does not use `xelatex` but uses `pdflatex`.\r\n\r\n### Code for reproduction\r\n\r\n```Python\r\n\"\"\"\r\n============\r\nPGF preamble\r\nmodified from the official example:\r\nhttps://matplotlib.org/stable/users/explain/text/pgf.html#custom-preamble\r\n============\r\n\"\"\"\r\n\r\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\n\r\n# \"The last method allows you to keep using regular interactive backends and to save xelatex, lualatex or pdflatex compiled PDF files from the graphical user interface.\" said by tutorial\r\nfrom matplotlib.backends.backend_pgf import FigureCanvasPgf\r\nmpl.backend_bases.register_backend(\"pdf\", FigureCanvasPgf)\r\n\r\n# mpl.use(\"pgf\")  # uncomment to work!\r\nplt.rcParams.update(\r\n    {\r\n        \"font.family\": \"serif\",  # use serif/main font for text elements\r\n        \"text.usetex\": True,  # use inline math for ticks\r\n        \"pgf.rcfonts\": False,  # don't setup fonts from rc parameters\r\n        \"pgf.preamble\": \"\\n\".join(\r\n            [\r\n                r\"\\usepackage{url}\",  # load additional packages\r\n                r\"\\usepackage{unicode-math}\",  # unicode math setup\r\n                r\"\\setmainfont{DejaVu Serif}\",  # serif font via preamble\r\n            ]\r\n        ),\r\n    }\r\n)\r\n\r\nfig, ax = plt.subplots(figsize=(4.5, 2.5))\r\n\r\nax.plot(range(5))\r\n\r\nax.set_xlabel(\"unicode text: я, ψ, €, ü\")\r\nax.set_ylabel(r\"\\url{https://matplotlib.org}\")\r\nax.legend([\"unicode math: $λ=∑_i^∞ μ_i^2$\"])\r\n\r\nfig.tight_layout(pad=0.5)\r\nplt.show()\r\n```\r\n\r\n\r\n### Actual outcome\r\n\r\n\u003cdetails\u003e\r\n\r\n\u003csummary\u003e\r\n\r\n```python-traceback\r\nRuntimeError: latex was not able to process the following string:\r\nb'unicode text: \\\\u044f, \\\\u03c8, \\\\u20ac, \\\\xfc'\r\n\r\nHere is the full command invocation and its output:\r\n\r\nlatex -interaction=nonstopmode --halt-on-error --output-directory=tmpsm7x8wc7 077a9af4443e140dcb75f16b8d670c44.tex\r\n\r\nThis is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024[/Arch](http://localhost:8888/Arch) Linux) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\n```\r\n\r\n\u003c/summary\u003e\r\n\r\n```python-traceback\r\n---------------------------------------------------------------------------\r\nRuntimeError                              Traceback (most recent call last)\r\nCell In[1], line 37\r\n     34 ax.set_ylabel(r\"\\url{https://matplotlib.org}\")\r\n     35 ax.legend([\"unicode math: $λ=∑_i^∞ μ_i^2$\"])\r\n---\u003e 37 fig.tight_layout(pad=0.5)\r\n     38 plt.show()\r\n     39 # fig.savefig(\"/tmp/test.pdf\")\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py:3540](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py#line=3539), in Figure.tight_layout(self, pad, h_pad, w_pad, rect)\r\n   3538 previous_engine = self.get_layout_engine()\r\n   3539 self.set_layout_engine(engine)\r\n-\u003e 3540 engine.execute(self)\r\n   3541 if previous_engine is not None and not isinstance(\r\n   3542     previous_engine, (TightLayoutEngine, PlaceHolderLayoutEngine)\r\n   3543 ):\r\n   3544     _api.warn_external('The figure layout has changed to tight')\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/layout_engine.py:183](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/layout_engine.py#line=182), in TightLayoutEngine.execute(self, fig)\r\n    181 renderer = fig._get_renderer()\r\n    182 with getattr(renderer, \"_draw_disabled\", nullcontext)():\r\n--\u003e 183     kwargs = get_tight_layout_figure(\r\n    184         fig, fig.axes, get_subplotspec_list(fig.axes), renderer,\r\n    185         pad=info['pad'], h_pad=info['h_pad'], w_pad=info['w_pad'],\r\n    186         rect=info['rect'])\r\n    187 if kwargs:\r\n    188     fig.subplots_adjust(**kwargs)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/_tight_layout.py:266](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/_tight_layout.py#line=265), in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)\r\n    261         return {}\r\n    262     span_pairs.append((\r\n    263         slice(ss.rowspan.start * div_row, ss.rowspan.stop * div_row),\r\n    264         slice(ss.colspan.start * div_col, ss.colspan.stop * div_col)))\r\n--\u003e 266 kwargs = _auto_adjust_subplotpars(fig, renderer,\r\n    267                                   shape=(max_nrows, max_ncols),\r\n    268                                   span_pairs=span_pairs,\r\n    269                                   subplot_list=subplot_list,\r\n    270                                   ax_bbox_list=ax_bbox_list,\r\n    271                                   pad=pad, h_pad=h_pad, w_pad=w_pad)\r\n    273 # kwargs can be none if tight_layout fails...\r\n    274 if rect is not None and kwargs is not None:\r\n    275     # if rect is given, the whole subplots area (including\r\n    276     # labels) will fit into the rect instead of the\r\n   (...)\r\n    280     # auto_adjust_subplotpars twice, where the second run\r\n    281     # with adjusted rect parameters.\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/_tight_layout.py:82](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/_tight_layout.py#line=81), in _auto_adjust_subplotpars(fig, renderer, shape, span_pairs, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect)\r\n     80 for ax in subplots:\r\n     81     if ax.get_visible():\r\n---\u003e 82         bb += [martist._get_tightbbox_for_layout_only(ax, renderer)]\r\n     84 tight_bbox_raw = Bbox.union(bb)\r\n     85 tight_bbox = fig.transFigure.inverted().transform_bbox(tight_bbox_raw)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:1411](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=1410), in _get_tightbbox_for_layout_only(obj, *args, **kwargs)\r\n   1405 \"\"\"\r\n   1406 Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a\r\n   1407 *for_layout_only* kwarg; this helper tries to use the kwarg but skips it\r\n   1408 when encountering third-party subclasses that do not support it.\r\n   1409 \"\"\"\r\n   1410 try:\r\n-\u003e 1411     return obj.get_tightbbox(*args, **{**kwargs, \"for_layout_only\": True})\r\n   1412 except TypeError:\r\n   1413     return obj.get_tightbbox(*args, **kwargs)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/_api/deprecation.py:454](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/_api/deprecation.py#line=453), in make_keyword_only.\u003clocals\u003e.wrapper(*args, **kwargs)\r\n    448 if len(args) \u003e name_idx:\r\n    449     warn_deprecated(\r\n    450         since, message=\"Passing the %(name)s %(obj_type)s \"\r\n    451         \"positionally is deprecated since Matplotlib %(since)s; the \"\r\n    452         \"parameter will become keyword-only %(removal)s.\",\r\n    453         name=name, obj_type=f\"parameter of {func.__name__}()\")\r\n--\u003e 454 return func(*args, **kwargs)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py:4395](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py#line=4394), in _AxesBase.get_tightbbox(self, renderer, call_axes_locator, bbox_extra_artists, for_layout_only)\r\n   4393 for axis in self._axis_map.values():\r\n   4394     if self.axison and axis.get_visible():\r\n-\u003e 4395         ba = martist._get_tightbbox_for_layout_only(axis, renderer)\r\n   4396         if ba:\r\n   4397             bb.append(ba)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:1411](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=1410), in _get_tightbbox_for_layout_only(obj, *args, **kwargs)\r\n   1405 \"\"\"\r\n   1406 Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a\r\n   1407 *for_layout_only* kwarg; this helper tries to use the kwarg but skips it\r\n   1408 when encountering third-party subclasses that do not support it.\r\n   1409 \"\"\"\r\n   1410 try:\r\n-\u003e 1411     return obj.get_tightbbox(*args, **{**kwargs, \"for_layout_only\": True})\r\n   1412 except TypeError:\r\n   1413     return obj.get_tightbbox(*args, **kwargs)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py:1352](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py#line=1351), in Axis.get_tightbbox(self, renderer, for_layout_only)\r\n   1350 # take care of label\r\n   1351 if self.label.get_visible():\r\n-\u003e 1352     bb = self.label.get_window_extent(renderer)\r\n   1353     # for constrained[/tight_layout](http://localhost:8888/tight_layout), we want to ignore the label's\r\n   1354     # width[/height](http://localhost:8888/height) because the adjustments they make can't be improved.\r\n   1355     # this code collapses the relevant direction\r\n   1356     if for_layout_only:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:956](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=955), in Text.get_window_extent(self, renderer, dpi)\r\n    951     raise RuntimeError(\r\n    952         \"Cannot get window extent of text w[/o](http://localhost:8888/o) renderer. You likely \"\r\n    953         \"want to call 'figure.draw_without_rendering()' first.\")\r\n    955 with cbook._setattr_cm(self.figure, dpi=dpi):\r\n--\u003e 956     bbox, info, descent = self._get_layout(self._renderer)\r\n    957     x, y = self.get_unitless_position()\r\n    958     x, y = self.get_transform().transform((x, y))\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:381](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=380), in Text._get_layout(self, renderer)\r\n    379 clean_line, ismath = self._preprocess_math(line)\r\n    380 if clean_line:\r\n--\u003e 381     w, h, d = _get_text_metrics_with_cache(\r\n    382         renderer, clean_line, self._fontproperties,\r\n    383         ismath=ismath, dpi=self.figure.dpi)\r\n    384 else:\r\n    385     w = h = d = 0\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:69](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=68), in _get_text_metrics_with_cache(renderer, text, fontprop, ismath, dpi)\r\n     66 \"\"\"Call ``renderer.get_text_width_height_descent``, caching the results.\"\"\"\r\n     67 # Cached based on a copy of fontprop so that later in-place mutations of\r\n     68 # the passed-in argument do not mess up the cache.\r\n---\u003e 69 return _get_text_metrics_with_cache_impl(\r\n     70     weakref.ref(renderer), text, fontprop.copy(), ismath, dpi)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:77](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=76), in _get_text_metrics_with_cache_impl(renderer_ref, text, fontprop, ismath, dpi)\r\n     73 @functools.lru_cache(4096)\r\n     74 def _get_text_metrics_with_cache_impl(\r\n     75         renderer_ref, text, fontprop, ismath, dpi):\r\n     76     # dpi is unused, but participates in cache invalidation (via the renderer).\r\n---\u003e 77     return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py:213](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py#line=212), in RendererAgg.get_text_width_height_descent(self, s, prop, ismath)\r\n    211 _api.check_in_list([\"TeX\", True, False], ismath=ismath)\r\n    212 if ismath == \"TeX\":\r\n--\u003e 213     return super().get_text_width_height_descent(s, prop, ismath)\r\n    215 if ismath:\r\n    216     ox, oy, width, height, descent, font_image = \\\r\n    217         self.mathtext_parser.parse(s, self.dpi, prop)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py:652](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py#line=651), in RendererBase.get_text_width_height_descent(self, s, prop, ismath)\r\n    648 fontsize = prop.get_size_in_points()\r\n    650 if ismath == 'TeX':\r\n    651     # todo: handle properties\r\n--\u003e 652     return self.get_texmanager().get_text_width_height_descent(\r\n    653         s, fontsize, renderer=self)\r\n    655 dpi = self.points_to_pixels(72)\r\n    656 if ismath:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:363](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=362), in TexManager.get_text_width_height_descent(cls, tex, fontsize, renderer)\r\n    361 if tex.strip() == '':\r\n    362     return 0, 0, 0\r\n--\u003e 363 dvifile = cls.make_dvi(tex, fontsize)\r\n    364 dpi_fraction = renderer.points_to_pixels(1.) if renderer else 1\r\n    365 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:295](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=294), in TexManager.make_dvi(cls, tex, fontsize)\r\n    293     with TemporaryDirectory(dir=cwd) as tmpdir:\r\n    294         tmppath = Path(tmpdir)\r\n--\u003e 295         cls._run_checked_subprocess(\r\n    296             [\"latex\", \"-interaction=nonstopmode\", \"--halt-on-error\",\r\n    297              f\"--output-directory={tmppath.name}\",\r\n    298              f\"{texfile.name}\"], tex, cwd=cwd)\r\n    299         (tmppath [/](http://localhost:8888/) Path(dvifile).name).replace(dvifile)\r\n    300 return dvifile\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:258](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=257), in TexManager._run_checked_subprocess(cls, command, tex, cwd)\r\n    254     raise RuntimeError(\r\n    255         f'Failed to process string with tex because {command[0]} '\r\n    256         'could not be found') from exc\r\n    257 except subprocess.CalledProcessError as exc:\r\n--\u003e 258     raise RuntimeError(\r\n    259         '{prog} was not able to process the following string:\\n'\r\n    260         '{tex!r}\\n\\n'\r\n    261         'Here is the full command invocation and its output:\\n\\n'\r\n    262         '{format_command}\\n\\n'\r\n    263         '{exc}\\n\\n'.format(\r\n    264             prog=command[0],\r\n    265             format_command=cbook._pformat_subprocess(command),\r\n    266             tex=tex.encode('unicode_escape'),\r\n    267             exc=exc.output.decode('utf-8', 'backslashreplace'))\r\n    268         ) from None\r\n    269 _log.debug(report)\r\n    270 return report\r\n\r\nRuntimeError: latex was not able to process the following string:\r\nb'unicode text: \\\\u044f, \\\\u03c8, \\\\u20ac, \\\\xfc'\r\n\r\nHere is the full command invocation and its output:\r\n\r\nlatex -interaction=nonstopmode --halt-on-error --output-directory=tmpsm7x8wc7 077a9af4443e140dcb75f16b8d670c44.tex\r\n\r\nThis is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024[/Arch](http://localhost:8888/Arch) Linux) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n(./077a9af4443e140dcb75f16b8d670c44.tex\r\nLaTeX2e \u003c2023-11-01\u003e patch level 1\r\nL3 programming layer \u003c2024-02-20\u003e\r\n([/usr/share/texmf-dist/tex/latex/base/article.cls](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/article.cls)\r\nDocument Class: article 2023[/05/17](http://localhost:8888/05/17) v1.4n Standard LaTeX document class\r\n([/usr/share/texmf-dist/tex/latex/base/size10.clo](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/size10.clo)))\r\n([/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty))\r\n([/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty)\r\n([/usr/share/texmf-dist/tex/latex/base/t1cmr.fd](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/t1cmr.fd)))\r\n([/usr/share/texmf-dist/tex/latex/base/inputenc.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/inputenc.sty))\r\n([/usr/share/texmf-dist/tex/latex/geometry/geometry.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/geometry/geometry.sty)\r\n([/usr/share/texmf-dist/tex/latex/graphics/keyval.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/graphics/keyval.sty))\r\n([/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty)\r\n([/usr/share/texmf-dist/tex/generic/iftex/iftex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/iftex.sty))))\r\n([/usr/share/texmf-dist/tex/latex/underscore/underscore.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/underscore/underscore.sty))\r\n([/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty))\r\n([/usr/share/texmf-dist/tex/latex/base/textcomp.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/textcomp.sty))\r\n([/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def](http://localhost:8888/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def))\r\nNo file 077a9af4443e140dcb75f16b8d670c44.aux.\r\n*geometry* driver: auto-detecting\r\n*geometry* detected driver: dvips\r\n\r\n! LaTeX Error: Unicode character я (U+044F)\r\n               not set up for use with LaTeX.\r\n\r\nSee the LaTeX manual or LaTeX Companion for explanation.\r\nType  H \u003creturn\u003e  for immediate help.\r\n ...                                              \r\n                                                  \r\nl.29 {\\rmfamily unicode text: я\r\n                                , ψ, €, ü}%\r\nNo pages of output.\r\nTranscript written on tmpsm7x8wc7[/077a9af4443e140dcb75f16b8d670c44.log.](http://localhost:8888/077a9af4443e140dcb75f16b8d670c44.log.)\r\n\r\n\r\nError in callback \u003cfunction _draw_all_if_interactive at 0x7feb602cc7c0\u003e (for post_execute), with arguments args (),kwargs {}:\r\n\r\n---------------------------------------------------------------------------\r\nRuntimeError                              Traceback (most recent call last)\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/pyplot.py:197](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/pyplot.py#line=196), in _draw_all_if_interactive()\r\n    195 def _draw_all_if_interactive() -\u003e None:\r\n    196     if matplotlib.is_interactive():\r\n--\u003e 197         draw_all()\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/_pylab_helpers.py:132](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/_pylab_helpers.py#line=131), in Gcf.draw_all(cls, force)\r\n    130 for manager in cls.get_all_fig_managers():\r\n    131     if force or manager.canvas.figure.stale:\r\n--\u003e 132         manager.canvas.draw_idle()\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py:1893](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py#line=1892), in FigureCanvasBase.draw_idle(self, *args, **kwargs)\r\n   1891 if not self._is_idle_drawing:\r\n   1892     with self._idle_draw_cntx():\r\n-\u003e 1893         self.draw(*args, **kwargs)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py:388](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py#line=387), in FigureCanvasAgg.draw(self)\r\n    385 # Acquire a lock on the shared font cache.\r\n    386 with (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar\r\n    387       else nullcontext()):\r\n--\u003e 388     self.figure.draw(self.renderer)\r\n    389     # A GUI class may be need to update a window using this draw, so\r\n    390     # don't forget to call the superclass.\r\n    391     super().draw()\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:95](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=94), in _finalize_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer, *args, **kwargs)\r\n     93 @wraps(draw)\r\n     94 def draw_wrapper(artist, renderer, *args, **kwargs):\r\n---\u003e 95     result = draw(artist, renderer, *args, **kwargs)\r\n     96     if renderer._rasterizing:\r\n     97         renderer.stop_rasterizing()\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py:3154](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py#line=3153), in Figure.draw(self, renderer)\r\n   3151         # ValueError can occur when resizing a window.\r\n   3153 self.patch.draw(renderer)\r\n-\u003e 3154 mimage._draw_list_compositing_images(\r\n   3155     renderer, self, artists, self.suppressComposite)\r\n   3157 for sfig in self.subfigs:\r\n   3158     sfig.draw(renderer)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/image.py:132](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/image.py#line=131), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130 if not_composite or not has_images:\r\n    131     for a in artists:\r\n--\u003e 132         a.draw(renderer)\r\n    133 else:\r\n    134     # Composite any adjacent images together\r\n    135     image_group = []\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py:3070](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py#line=3069), in _AxesBase.draw(self, renderer)\r\n   3067 if artists_rasterized:\r\n   3068     _draw_rasterized(self.figure, artists_rasterized, renderer)\r\n-\u003e 3070 mimage._draw_list_compositing_images(\r\n   3071     renderer, self, artists, self.figure.suppressComposite)\r\n   3073 renderer.close_group('axes')\r\n   3074 self.stale = False\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/image.py:132](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/image.py#line=131), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130 if not_composite or not has_images:\r\n    131     for a in artists:\r\n--\u003e 132         a.draw(renderer)\r\n    133 else:\r\n    134     # Composite any adjacent images together\r\n    135     image_group = []\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py:1395](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py#line=1394), in Axis.draw(self, renderer, *args, **kwargs)\r\n   1393 # Shift label away from axes to avoid overlapping ticklabels.\r\n   1394 self._update_label_position(renderer)\r\n-\u003e 1395 self.label.draw(renderer)\r\n   1397 self._update_offset_text_position(tlb1, tlb2)\r\n   1398 self.offsetText.set_text(self.major.formatter.get_offset())\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:748](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=747), in Text.draw(self, renderer)\r\n    745 renderer.open_group('text', self.get_gid())\r\n    747 with self._cm_set(text=self._get_wrapped_text()):\r\n--\u003e 748     bbox, info, descent = self._get_layout(renderer)\r\n    749     trans = self.get_transform()\r\n    751     # don't use self.get_position here, which refers to text\r\n    752     # position in Text:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:381](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=380), in Text._get_layout(self, renderer)\r\n    379 clean_line, ismath = self._preprocess_math(line)\r\n    380 if clean_line:\r\n--\u003e 381     w, h, d = _get_text_metrics_with_cache(\r\n    382         renderer, clean_line, self._fontproperties,\r\n    383         ismath=ismath, dpi=self.figure.dpi)\r\n    384 else:\r\n    385     w = h = d = 0\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:69](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=68), in _get_text_metrics_with_cache(renderer, text, fontprop, ismath, dpi)\r\n     66 \"\"\"Call ``renderer.get_text_width_height_descent``, caching the results.\"\"\"\r\n     67 # Cached based on a copy of fontprop so that later in-place mutations of\r\n     68 # the passed-in argument do not mess up the cache.\r\n---\u003e 69 return _get_text_metrics_with_cache_impl(\r\n     70     weakref.ref(renderer), text, fontprop.copy(), ismath, dpi)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:77](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=76), in _get_text_metrics_with_cache_impl(renderer_ref, text, fontprop, ismath, dpi)\r\n     73 @functools.lru_cache(4096)\r\n     74 def _get_text_metrics_with_cache_impl(\r\n     75         renderer_ref, text, fontprop, ismath, dpi):\r\n     76     # dpi is unused, but participates in cache invalidation (via the renderer).\r\n---\u003e 77     return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py:213](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py#line=212), in RendererAgg.get_text_width_height_descent(self, s, prop, ismath)\r\n    211 _api.check_in_list([\"TeX\", True, False], ismath=ismath)\r\n    212 if ismath == \"TeX\":\r\n--\u003e 213     return super().get_text_width_height_descent(s, prop, ismath)\r\n    215 if ismath:\r\n    216     ox, oy, width, height, descent, font_image = \\\r\n    217         self.mathtext_parser.parse(s, self.dpi, prop)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py:652](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py#line=651), in RendererBase.get_text_width_height_descent(self, s, prop, ismath)\r\n    648 fontsize = prop.get_size_in_points()\r\n    650 if ismath == 'TeX':\r\n    651     # todo: handle properties\r\n--\u003e 652     return self.get_texmanager().get_text_width_height_descent(\r\n    653         s, fontsize, renderer=self)\r\n    655 dpi = self.points_to_pixels(72)\r\n    656 if ismath:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:363](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=362), in TexManager.get_text_width_height_descent(cls, tex, fontsize, renderer)\r\n    361 if tex.strip() == '':\r\n    362     return 0, 0, 0\r\n--\u003e 363 dvifile = cls.make_dvi(tex, fontsize)\r\n    364 dpi_fraction = renderer.points_to_pixels(1.) if renderer else 1\r\n    365 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:295](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=294), in TexManager.make_dvi(cls, tex, fontsize)\r\n    293     with TemporaryDirectory(dir=cwd) as tmpdir:\r\n    294         tmppath = Path(tmpdir)\r\n--\u003e 295         cls._run_checked_subprocess(\r\n    296             [\"latex\", \"-interaction=nonstopmode\", \"--halt-on-error\",\r\n    297              f\"--output-directory={tmppath.name}\",\r\n    298              f\"{texfile.name}\"], tex, cwd=cwd)\r\n    299         (tmppath [/](http://localhost:8888/) Path(dvifile).name).replace(dvifile)\r\n    300 return dvifile\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:258](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=257), in TexManager._run_checked_subprocess(cls, command, tex, cwd)\r\n    254     raise RuntimeError(\r\n    255         f'Failed to process string with tex because {command[0]} '\r\n    256         'could not be found') from exc\r\n    257 except subprocess.CalledProcessError as exc:\r\n--\u003e 258     raise RuntimeError(\r\n    259         '{prog} was not able to process the following string:\\n'\r\n    260         '{tex!r}\\n\\n'\r\n    261         'Here is the full command invocation and its output:\\n\\n'\r\n    262         '{format_command}\\n\\n'\r\n    263         '{exc}\\n\\n'.format(\r\n    264             prog=command[0],\r\n    265             format_command=cbook._pformat_subprocess(command),\r\n    266             tex=tex.encode('unicode_escape'),\r\n    267             exc=exc.output.decode('utf-8', 'backslashreplace'))\r\n    268         ) from None\r\n    269 _log.debug(report)\r\n    270 return report\r\n\r\nRuntimeError: latex was not able to process the following string:\r\nb'unicode text: \\\\u044f, \\\\u03c8, \\\\u20ac, \\\\xfc'\r\n\r\nHere is the full command invocation and its output:\r\n\r\nlatex -interaction=nonstopmode --halt-on-error --output-directory=tmpb6xko1st 077a9af4443e140dcb75f16b8d670c44.tex\r\n\r\nThis is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024[/Arch](http://localhost:8888/Arch) Linux) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n(./077a9af4443e140dcb75f16b8d670c44.tex\r\nLaTeX2e \u003c2023-11-01\u003e patch level 1\r\nL3 programming layer \u003c2024-02-20\u003e\r\n([/usr/share/texmf-dist/tex/latex/base/article.cls](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/article.cls)\r\nDocument Class: article 2023[/05/17](http://localhost:8888/05/17) v1.4n Standard LaTeX document class\r\n([/usr/share/texmf-dist/tex/latex/base/size10.clo](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/size10.clo)))\r\n([/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty))\r\n([/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty)\r\n([/usr/share/texmf-dist/tex/latex/base/t1cmr.fd](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/t1cmr.fd)))\r\n([/usr/share/texmf-dist/tex/latex/base/inputenc.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/inputenc.sty))\r\n([/usr/share/texmf-dist/tex/latex/geometry/geometry.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/geometry/geometry.sty)\r\n([/usr/share/texmf-dist/tex/latex/graphics/keyval.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/graphics/keyval.sty))\r\n([/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty)\r\n([/usr/share/texmf-dist/tex/generic/iftex/iftex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/iftex.sty))))\r\n([/usr/share/texmf-dist/tex/latex/underscore/underscore.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/underscore/underscore.sty))\r\n([/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty))\r\n([/usr/share/texmf-dist/tex/latex/base/textcomp.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/textcomp.sty))\r\n([/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def](http://localhost:8888/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def))\r\nNo file 077a9af4443e140dcb75f16b8d670c44.aux.\r\n*geometry* driver: auto-detecting\r\n*geometry* detected driver: dvips\r\n\r\n! LaTeX Error: Unicode character я (U+044F)\r\n               not set up for use with LaTeX.\r\n\r\nSee the LaTeX manual or LaTeX Companion for explanation.\r\nType  H \u003creturn\u003e  for immediate help.\r\n ...                                              \r\n                                                  \r\nl.29 {\\rmfamily unicode text: я\r\n                                , ψ, €, ü}%\r\nNo pages of output.\r\nTranscript written on tmpb6xko1st[/077a9af4443e140dcb75f16b8d670c44.log.](http://localhost:8888/077a9af4443e140dcb75f16b8d670c44.log.)\r\n\r\n\r\n---------------------------------------------------------------------------\r\nRuntimeError                              Traceback (most recent call last)\r\nFile [~/mambaforge/lib/python3.11/site-packages/IPython/core/formatters.py:343](http://localhost:8888/mambaforge/lib/python3.11/site-packages/IPython/core/formatters.py#line=342), in BaseFormatter.__call__(self, obj)\r\n    341     pass\r\n    342 else:\r\n--\u003e 343     return printer(obj)\r\n    344 # Finally look for special method names\r\n    345 method = get_real_method(obj, self.print_method)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/IPython/core/pylabtools.py:152](http://localhost:8888/mambaforge/lib/python3.11/site-packages/IPython/core/pylabtools.py#line=151), in print_figure(fig, fmt, bbox_inches, base64, **kwargs)\r\n    149     from matplotlib.backend_bases import FigureCanvasBase\r\n    150     FigureCanvasBase(fig)\r\n--\u003e 152 fig.canvas.print_figure(bytes_io, **kw)\r\n    153 data = bytes_io.getvalue()\r\n    154 if fmt == 'svg':\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py:2164](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py#line=2163), in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)\r\n   2161     # we do this instead of `self.figure.draw_without_rendering`\r\n   2162     # so that we can inject the orientation\r\n   2163     with getattr(renderer, \"_draw_disabled\", nullcontext)():\r\n-\u003e 2164         self.figure.draw(renderer)\r\n   2165 if bbox_inches:\r\n   2166     if bbox_inches == \"tight\":\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:95](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=94), in _finalize_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer, *args, **kwargs)\r\n     93 @wraps(draw)\r\n     94 def draw_wrapper(artist, renderer, *args, **kwargs):\r\n---\u003e 95     result = draw(artist, renderer, *args, **kwargs)\r\n     96     if renderer._rasterizing:\r\n     97         renderer.stop_rasterizing()\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py:3154](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/figure.py#line=3153), in Figure.draw(self, renderer)\r\n   3151         # ValueError can occur when resizing a window.\r\n   3153 self.patch.draw(renderer)\r\n-\u003e 3154 mimage._draw_list_compositing_images(\r\n   3155     renderer, self, artists, self.suppressComposite)\r\n   3157 for sfig in self.subfigs:\r\n   3158     sfig.draw(renderer)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/image.py:132](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/image.py#line=131), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130 if not_composite or not has_images:\r\n    131     for a in artists:\r\n--\u003e 132         a.draw(renderer)\r\n    133 else:\r\n    134     # Composite any adjacent images together\r\n    135     image_group = []\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py:3070](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axes/_base.py#line=3069), in _AxesBase.draw(self, renderer)\r\n   3067 if artists_rasterized:\r\n   3068     _draw_rasterized(self.figure, artists_rasterized, renderer)\r\n-\u003e 3070 mimage._draw_list_compositing_images(\r\n   3071     renderer, self, artists, self.figure.suppressComposite)\r\n   3073 renderer.close_group('axes')\r\n   3074 self.stale = False\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/image.py:132](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/image.py#line=131), in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130 if not_composite or not has_images:\r\n    131     for a in artists:\r\n--\u003e 132         a.draw(renderer)\r\n    133 else:\r\n    134     # Composite any adjacent images together\r\n    135     image_group = []\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py:1395](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/axis.py#line=1394), in Axis.draw(self, renderer, *args, **kwargs)\r\n   1393 # Shift label away from axes to avoid overlapping ticklabels.\r\n   1394 self._update_label_position(renderer)\r\n-\u003e 1395 self.label.draw(renderer)\r\n   1397 self._update_offset_text_position(tlb1, tlb2)\r\n   1398 self.offsetText.set_text(self.major.formatter.get_offset())\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py:72](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/artist.py#line=71), in allow_rasterization.\u003clocals\u003e.draw_wrapper(artist, renderer)\r\n     69     if artist.get_agg_filter() is not None:\r\n     70         renderer.start_filter()\r\n---\u003e 72     return draw(artist, renderer)\r\n     73 finally:\r\n     74     if artist.get_agg_filter() is not None:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:748](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=747), in Text.draw(self, renderer)\r\n    745 renderer.open_group('text', self.get_gid())\r\n    747 with self._cm_set(text=self._get_wrapped_text()):\r\n--\u003e 748     bbox, info, descent = self._get_layout(renderer)\r\n    749     trans = self.get_transform()\r\n    751     # don't use self.get_position here, which refers to text\r\n    752     # position in Text:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:381](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=380), in Text._get_layout(self, renderer)\r\n    379 clean_line, ismath = self._preprocess_math(line)\r\n    380 if clean_line:\r\n--\u003e 381     w, h, d = _get_text_metrics_with_cache(\r\n    382         renderer, clean_line, self._fontproperties,\r\n    383         ismath=ismath, dpi=self.figure.dpi)\r\n    384 else:\r\n    385     w = h = d = 0\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:69](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=68), in _get_text_metrics_with_cache(renderer, text, fontprop, ismath, dpi)\r\n     66 \"\"\"Call ``renderer.get_text_width_height_descent``, caching the results.\"\"\"\r\n     67 # Cached based on a copy of fontprop so that later in-place mutations of\r\n     68 # the passed-in argument do not mess up the cache.\r\n---\u003e 69 return _get_text_metrics_with_cache_impl(\r\n     70     weakref.ref(renderer), text, fontprop.copy(), ismath, dpi)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/text.py:77](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/text.py#line=76), in _get_text_metrics_with_cache_impl(renderer_ref, text, fontprop, ismath, dpi)\r\n     73 @functools.lru_cache(4096)\r\n     74 def _get_text_metrics_with_cache_impl(\r\n     75         renderer_ref, text, fontprop, ismath, dpi):\r\n     76     # dpi is unused, but participates in cache invalidation (via the renderer).\r\n---\u003e 77     return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py:213](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backends/backend_agg.py#line=212), in RendererAgg.get_text_width_height_descent(self, s, prop, ismath)\r\n    211 _api.check_in_list([\"TeX\", True, False], ismath=ismath)\r\n    212 if ismath == \"TeX\":\r\n--\u003e 213     return super().get_text_width_height_descent(s, prop, ismath)\r\n    215 if ismath:\r\n    216     ox, oy, width, height, descent, font_image = \\\r\n    217         self.mathtext_parser.parse(s, self.dpi, prop)\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py:652](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/backend_bases.py#line=651), in RendererBase.get_text_width_height_descent(self, s, prop, ismath)\r\n    648 fontsize = prop.get_size_in_points()\r\n    650 if ismath == 'TeX':\r\n    651     # todo: handle properties\r\n--\u003e 652     return self.get_texmanager().get_text_width_height_descent(\r\n    653         s, fontsize, renderer=self)\r\n    655 dpi = self.points_to_pixels(72)\r\n    656 if ismath:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:363](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=362), in TexManager.get_text_width_height_descent(cls, tex, fontsize, renderer)\r\n    361 if tex.strip() == '':\r\n    362     return 0, 0, 0\r\n--\u003e 363 dvifile = cls.make_dvi(tex, fontsize)\r\n    364 dpi_fraction = renderer.points_to_pixels(1.) if renderer else 1\r\n    365 with dviread.Dvi(dvifile, 72 * dpi_fraction) as dvi:\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:295](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=294), in TexManager.make_dvi(cls, tex, fontsize)\r\n    293     with TemporaryDirectory(dir=cwd) as tmpdir:\r\n    294         tmppath = Path(tmpdir)\r\n--\u003e 295         cls._run_checked_subprocess(\r\n    296             [\"latex\", \"-interaction=nonstopmode\", \"--halt-on-error\",\r\n    297              f\"--output-directory={tmppath.name}\",\r\n    298              f\"{texfile.name}\"], tex, cwd=cwd)\r\n    299         (tmppath [/](http://localhost:8888/) Path(dvifile).name).replace(dvifile)\r\n    300 return dvifile\r\n\r\nFile [~/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py:258](http://localhost:8888/mambaforge/lib/python3.11/site-packages/matplotlib/texmanager.py#line=257), in TexManager._run_checked_subprocess(cls, command, tex, cwd)\r\n    254     raise RuntimeError(\r\n    255         f'Failed to process string with tex because {command[0]} '\r\n    256         'could not be found') from exc\r\n    257 except subprocess.CalledProcessError as exc:\r\n--\u003e 258     raise RuntimeError(\r\n    259         '{prog} was not able to process the following string:\\n'\r\n    260         '{tex!r}\\n\\n'\r\n    261         'Here is the full command invocation and its output:\\n\\n'\r\n    262         '{format_command}\\n\\n'\r\n    263         '{exc}\\n\\n'.format(\r\n    264             prog=command[0],\r\n    265             format_command=cbook._pformat_subprocess(command),\r\n    266             tex=tex.encode('unicode_escape'),\r\n    267             exc=exc.output.decode('utf-8', 'backslashreplace'))\r\n    268         ) from None\r\n    269 _log.debug(report)\r\n    270 return report\r\n\r\nRuntimeError: latex was not able to process the following string:\r\nb'unicode text: \\\\u044f, \\\\u03c8, \\\\u20ac, \\\\xfc'\r\n\r\nHere is the full command invocation and its output:\r\n\r\nlatex -interaction=nonstopmode --halt-on-error --output-directory=tmp0lcpl6of 077a9af4443e140dcb75f16b8d670c44.tex\r\n\r\nThis is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024[/Arch](http://localhost:8888/Arch) Linux) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n(./077a9af4443e140dcb75f16b8d670c44.tex\r\nLaTeX2e \u003c2023-11-01\u003e patch level 1\r\nL3 programming layer \u003c2024-02-20\u003e\r\n([/usr/share/texmf-dist/tex/latex/base/article.cls](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/article.cls)\r\nDocument Class: article 2023[/05/17](http://localhost:8888/05/17) v1.4n Standard LaTeX document class\r\n([/usr/share/texmf-dist/tex/latex/base/size10.clo](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/size10.clo)))\r\n([/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/type1cm/type1cm.sty))\r\n([/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/cm-super/type1ec.sty)\r\n([/usr/share/texmf-dist/tex/latex/base/t1cmr.fd](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/t1cmr.fd)))\r\n([/usr/share/texmf-dist/tex/latex/base/inputenc.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/inputenc.sty))\r\n([/usr/share/texmf-dist/tex/latex/geometry/geometry.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/geometry/geometry.sty)\r\n([/usr/share/texmf-dist/tex/latex/graphics/keyval.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/graphics/keyval.sty))\r\n([/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty)\r\n([/usr/share/texmf-dist/tex/generic/iftex/iftex.sty](http://localhost:8888/usr/share/texmf-dist/tex/generic/iftex/iftex.sty))))\r\n([/usr/share/texmf-dist/tex/latex/underscore/underscore.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/underscore/underscore.sty))\r\n([/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/firstaid/underscore-ltx.sty))\r\n([/usr/share/texmf-dist/tex/latex/base/textcomp.sty](http://localhost:8888/usr/share/texmf-dist/tex/latex/base/textcomp.sty))\r\n([/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def](http://localhost:8888/usr/share/texmf-dist/tex/latex/l3backend/l3backend-dvips.def))\r\nNo file 077a9af4443e140dcb75f16b8d670c44.aux.\r\n*geometry* driver: auto-detecting\r\n*geometry* detected driver: dvips\r\n\r\n! LaTeX Error: Unicode character я (U+044F)\r\n               not set up for use with LaTeX.\r\n\r\nSee the LaTeX manual or LaTeX Companion for explanation.\r\nType  H \u003creturn\u003e  for immediate help.\r\n ...                                              \r\n                                                  \r\nl.29 {\\rmfamily unicode text: я\r\n                                , ψ, €, ü}%\r\nNo pages of output.\r\nTranscript written on tmp0lcpl6of[/077a9af4443e140dcb75f16b8d670c44.log.](http://localhost:8888/077a9af4443e140dcb75f16b8d670c44.log.)\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\n### Expected outcome\r\n\r\nIt should use `xelatex` and works like `mpl.use(\"pgf\")`, and then display the plot under the cell.\r\nThis works:\r\n```python\r\n\"\"\"\r\n============\r\nPGF preamble\r\n============\r\n\"\"\"\r\n\r\nimport matplotlib as mpl\r\nimport matplotlib.pyplot as plt\r\n\r\nmpl.use(\"pgf\")\r\nplt.rcParams.update(\r\n    {\r\n        \"font.family\": \"serif\",  # use serif/main font for text elements\r\n        \"text.usetex\": True,  # use inline math for ticks\r\n        \"pgf.rcfonts\": False,  # don't setup fonts from rc parameters\r\n        \"pgf.preamble\": \"\\n\".join(\r\n            [\r\n                r\"\\usepackage{url}\",  # load additional packages\r\n                r\"\\usepackage{unicode-math}\",  # unicode math setup\r\n                r\"\\setmainfont{DejaVu Serif}\",  # serif font via preamble\r\n            ]\r\n        ),\r\n    }\r\n)\r\n\r\nfig, ax = plt.subplots(figsize=(4.5, 2.5))\r\n\r\nax.plot(range(5))\r\n\r\nax.set_xlabel(\"unicode text: я, ψ, €, ü\")\r\nax.set_ylabel(r\"\\url{https://matplotlib.org}\")\r\nax.legend([\"unicode math: $λ=∑_i^∞ μ_i^2$\"])\r\n\r\nfig.tight_layout(pad=0.5)\r\n\r\n%matplotlib inline  # magic code works as expect!\r\nplt.show()\r\n```\r\n\r\n### Additional information\r\n\r\n_No response_\r\n\r\n### Operating system\r\n\r\nArch\r\n\r\n### Matplotlib Version\r\n\r\n3.8.4\r\n\r\n### Matplotlib Backend\r\n\r\nmodule://matplotlib_inline.backend_inline\r\n\r\n### Python version\r\n\r\n3.11.8\r\n\r\n### Jupyter version\r\n\r\n4.1.6\r\n\r\n### Installation\r\n\r\nconda","author":{"url":"https://github.com/pikakolendo02","@type":"Person","name":"pikakolendo02"},"datePublished":"2024-04-16T03:44:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/28084/matplotlib/issues/28084"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:81dd9947-ceac-d98b-5950-85666952453b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC2C6:1DF5CE:3198E:3F96A:6A521C91
html-safe-noncec67299e385591f1eca76d07e1aab4ad7e3c43a6e09cb79218cf319df9e7f0944
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkM2OjFERjVDRTozMTk4RTozRjk2QTo2QTUyMUM5MSIsInZpc2l0b3JfaWQiOiI2ODYyMTE4NjY4NDk2NjczOTM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac54ea1aa6a67c340c3e2cbb759a6e33030bb2a2af2e491fbb4e02622634802b1b
hovercard-subject-tagissue:2245029558
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/28084/issue_layout
twitter:imagehttps://opengraph.githubassets.com/964f09587344f9883deeef689a1829e48012b527236ba5a211a3c7e8013ad257/matplotlib/matplotlib/issues/28084
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/964f09587344f9883deeef689a1829e48012b527236ba5a211a3c7e8013ad257/matplotlib/matplotlib/issues/28084
og:image:altBug summary FigureCanvasPgf does not use xelatex but uses pdflatex. Code for reproduction """ ============ PGF preamble modified from the official example: https://matplotlib.org/stable/users/expla...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepikakolendo02
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/28084#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F28084
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F28084
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/28084
Reloadhttps://github.com/matplotlib/matplotlib/issues/28084
Reloadhttps://github.com/matplotlib/matplotlib/issues/28084
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/28084
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/28084
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 409 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
[Bug]: FigureCanvasPgf does not use xelatexhttps://github.com/matplotlib/matplotlib/issues/28084#top
https://github.com/pikakolendo02
pikakolendo02https://github.com/pikakolendo02
on Apr 16, 2024https://github.com/matplotlib/matplotlib/issues/28084#issue-2245029558
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.