Title: Setting plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) causes Error · Issue #10317 · matplotlib/matplotlib · GitHub
Open Graph Title: Setting plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) causes Error · Issue #10317 · matplotlib/matplotlib
X Title: Setting plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) causes Error · Issue #10317 · matplotlib/matplotlib
Description: Bug report Bug summary If I call plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) and plot a image with a colorbar. The plot will not work and a Latex runtime error is thrown. If you switch the commands everythi...
Open Graph Description: Bug report Bug summary If I call plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) and plot a image with a colorbar. The plot will not work and a Latex runtime error is thr...
X Description: Bug report Bug summary If I call plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) and plot a image with a colorbar. The plot will not work and a Latex runtime erro...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/10317
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Setting plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) causes Error","articleBody":"\u003c!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--\u003e\r\n\u003c!--You can feel free to delete the sections that do not apply.--\u003e\r\n\r\n### Bug report\r\n\r\n**Bug summary**\r\n\r\nIf I call `plt.rc('text', usetex=True)` **after** `ticker.ScalarFormatter(useMathText=True)` and plot a image with a colorbar. The plot will not work and a Latex runtime error is thrown.\r\nIf you switch the commands everything works fine.\r\n\r\n**Code for reproduction**\r\n\r\n\u003c!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--\u003e\r\n\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib import ticker\r\n\r\ncbformat = ticker.ScalarFormatter(useMathText=True)\r\nplt.rc('text', usetex=True)\r\n\r\nplt.imshow(np.random.random((5, 5)))\r\nplt.colorbar(format=cbformat)\r\nplt.show()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n\u003c!--The output produced by the above code, which may be a screenshot, console output, etc.--\u003e\r\n\r\n```\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 393, in make_dvi\r\n stderr=subprocess.STDOUT)\r\n File \"/usr/lib/python3.6/subprocess.py\", line 336, in check_output\r\n **kwargs).stdout\r\n File \"/usr/lib/python3.6/subprocess.py\", line 418, in run\r\n output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '3a8b8f2d899e29dc96ac7c7cd31a754a.tex']' returned non-zero exit status 1.\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.6/tkinter/__init__.py\", line 1702, in __call__\r\n return self.func(*args)\r\n File \"/usr/lib/python3.6/tkinter/__init__.py\", line 748, in callit\r\n func(*args)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py\", line 323, in idle_draw\r\n self.draw()\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py\", line 304, in draw\r\n FigureCanvasAgg.draw(self)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_agg.py\", line 430, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/figure.py\", line 1299, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_base.py\", line 2437, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axis.py\", line 1135, in draw\r\n renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axis.py\", line 1078, in _get_tick_bboxes\r\n extent = tick.label2.get_window_extent(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/text.py\", line 933, in get_window_extent\r\n bbox, info, descent = self._get_layout(self._renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/text.py\", line 317, in _get_layout\r\n ismath=ismath)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_agg.py\", line 226, in get_text_width_height_descent\r\n s, fontsize, renderer=self)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 602, in get_text_width_height_descent\r\n dvifile = self.make_dvi(tex, fontsize)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 400, in make_dvi\r\n exc.output.decode(\"utf-8\"))))\r\nRuntimeError: LaTeX was not able to process the following string:\r\nb'$\\\\\\\\mathdefault{0.6}$'\r\n\r\nHere is the full report generated by LaTeX:\r\nThis is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n(./3a8b8f2d899e29dc96ac7c7cd31a754a.tex\r\nLaTeX2e \u003c2017-04-15\u003e\r\nBabel \u003c3.12\u003e and hyphenation patterns for 14 language(s) loaded.\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\r\nDocument Class: article 2014/09/29 v1.4h Standard LaTeX document class\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))\r\n(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def))\r\n(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty\r\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)\r\n\r\nPackage geometry Warning: Over-specification in `h'-direction.\r\n `width' (5058.9pt) is ignored.\r\n\r\n\r\nPackage geometry Warning: Over-specification in `v'-direction.\r\n `height' (5058.9pt) is ignored.\r\n\r\n)\r\nNo file 3a8b8f2d899e29dc96ac7c7cd31a754a.aux.\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)\r\n*geometry* driver: auto-detecting\r\n*geometry* detected driver: dvips\r\n! Undefined control sequence.\r\n\u003crecently read\u003e \\mathdefault \r\n \r\nl.12 ...000000}{12.500000}{\\sffamily $\\mathdefault\r\n {0.6}$}\r\n[1] (./3a8b8f2d899e29dc96ac7c7cd31a754a.aux) )\r\n(see the transcript file for additional information)\r\nOutput written on 3a8b8f2d899e29dc96ac7c7cd31a754a.dvi (1 page, 288 bytes).\r\nTranscript written on 3a8b8f2d899e29dc96ac7c7cd31a754a.log.\r\n \r\n\r\n\r\nException in Tkinter callback\r\nTraceback (most recent call last):\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 393, in make_dvi\r\n stderr=subprocess.STDOUT)\r\n File \"/usr/lib/python3.6/subprocess.py\", line 336, in check_output\r\n **kwargs).stdout\r\n File \"/usr/lib/python3.6/subprocess.py\", line 418, in run\r\n output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['latex', '-interaction=nonstopmode', '3763d70561037cddae6a97acb53ffec4.tex']' returned non-zero exit status 1.\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/usr/lib/python3.6/tkinter/__init__.py\", line 1702, in __call__\r\n return self.func(*args)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py\", line 233, in resize\r\n self.show()\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py\", line 304, in draw\r\n FigureCanvasAgg.draw(self)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_agg.py\", line 430, in draw\r\n self.figure.draw(self.renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/figure.py\", line 1299, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_base.py\", line 2437, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/artist.py\", line 55, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axis.py\", line 1135, in draw\r\n renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/axis.py\", line 1078, in _get_tick_bboxes\r\n extent = tick.label2.get_window_extent(renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/text.py\", line 933, in get_window_extent\r\n bbox, info, descent = self._get_layout(self._renderer)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/text.py\", line 317, in _get_layout\r\n ismath=ismath)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_agg.py\", line 226, in get_text_width_height_descent\r\n s, fontsize, renderer=self)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 602, in get_text_width_height_descent\r\n dvifile = self.make_dvi(tex, fontsize)\r\n File \"/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py\", line 400, in make_dvi\r\n exc.output.decode(\"utf-8\"))))\r\nRuntimeError: LaTeX was not able to process the following string:\r\nb'$\\\\\\\\mathdefault{0.8}$'\r\n\r\nHere is the full report generated by LaTeX:\r\nThis is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=latex)\r\n restricted \\write18 enabled.\r\nentering extended mode\r\n(./3763d70561037cddae6a97acb53ffec4.tex\r\nLaTeX2e \u003c2017-04-15\u003e\r\nBabel \u003c3.12\u003e and hyphenation patterns for 14 language(s) loaded.\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\r\nDocument Class: article 2014/09/29 v1.4h Standard LaTeX document class\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))\r\n(/usr/share/texlive/texmf-dist/tex/latex/type1cm/type1cm.sty)\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def))\r\n(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty\r\n(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)\r\n(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty)\r\n\r\nPackage geometry Warning: Over-specification in `h'-direction.\r\n `width' (5058.9pt) is ignored.\r\n\r\n\r\nPackage geometry Warning: Over-specification in `v'-direction.\r\n `height' (5058.9pt) is ignored.\r\n\r\n)\r\nNo file 3763d70561037cddae6a97acb53ffec4.aux.\r\n(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd)\r\n*geometry* driver: auto-detecting\r\n*geometry* detected driver: dvips\r\n! Undefined control sequence.\r\n\u003crecently read\u003e \\mathdefault \r\n \r\nl.12 ...000000}{12.500000}{\\sffamily $\\mathdefault\r\n {0.8}$}\r\n[1] (./3763d70561037cddae6a97acb53ffec4.aux) )\r\n(see the transcript file for additional information)\r\nOutput written on 3763d70561037cddae6a97acb53ffec4.dvi (1 page, 288 bytes).\r\nTranscript written on 3763d70561037cddae6a97acb53ffec4.log.\r\n```\r\n\r\n\r\n\r\n**Matplotlib version**\r\n\u003c!--Please specify your platform and versions of the relevant libraries you are using:--\u003e\r\n * Operating system: Kubuntu 17.10\r\n * Matplotlib version: 2.1.1\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): TkAgg\r\n * Python version: 3.6\r\n\r\n\r\n\u003c!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--\u003e\r\n\u003c!--If you installed from conda, please specify which channel you used if not the default--\u003e\r\n\r\n","author":{"url":"https://github.com/svrnwnsch","@type":"Person","name":"svrnwnsch"},"datePublished":"2018-01-25T01:21:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/10317/matplotlib/issues/10317"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dfdfaf95-7b50-244f-ef7d-520b4024ad29 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B12:3FABDA:66E00A:9312EE:6A573751 |
| html-safe-nonce | 4c0e7578b1ae283f554ed49ad92a498eb1f3949a284e02e6f2450bbcdb9206f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjEyOjNGQUJEQTo2NkUwMEE6OTMxMkVFOjZBNTczNzUxIiwidmlzaXRvcl9pZCI6IjY0NzQxMzMwNjQxMDA4MjA4MTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 78ee138d81acf8892902fefa32380af48fed158b90d1535f5a4585cfafcaff2d |
| hovercard-subject-tag | issue:291418641 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/10317/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff487ad337937b6c389af6c8396dff8ba359c00086f9778487bbe45f56baa173/matplotlib/matplotlib/issues/10317 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff487ad337937b6c389af6c8396dff8ba359c00086f9778487bbe45f56baa173/matplotlib/matplotlib/issues/10317 |
| og:image:alt | Bug report Bug summary If I call plt.rc('text', usetex=True) after ticker.ScalarFormatter(useMathText=True) and plot a image with a colorbar. The plot will not work and a Latex runtime error is thr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | svrnwnsch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4e7a7296a3830877cf21a6ad2a972c9e618a48915e03966cf0c53eb08e5aad98 |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2576d1f0198cf1588faf2edf27f1ed120903be10 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width