Title: BUG: TypeError in plt.savefig using cairo backend · Issue #12806 · matplotlib/matplotlib · GitHub
Open Graph Title: BUG: TypeError in plt.savefig using cairo backend · Issue #12806 · matplotlib/matplotlib
X Title: BUG: TypeError in plt.savefig using cairo backend · Issue #12806 · matplotlib/matplotlib
Description: Saving a figure with plt.savefig in svg file format using the cairo backend results in a TypeError. The Traceback is: File "/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/util/plot.py", line 814...
Open Graph Description: Saving a figure with plt.savefig in svg file format using the cairo backend results in a TypeError. The Traceback is: File "/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3...
X Description: Saving a figure with plt.savefig in svg file format using the cairo backend results in a TypeError. The Traceback is: File "/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/py...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/12806
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BUG: TypeError in plt.savefig using cairo backend","articleBody":"Saving a figure with `plt.savefig` in `svg` file format using the `cairo` backend results in a `TypeError`. The Traceback is:\r\n\r\n```\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/util/plot.py\", line 814, in save_and_close_fig\r\n plt.savefig('plot.svg', transparent=True, dpi=800)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/pyplot.py\", line 689, in savefig\r\n res = fig.savefig(*args, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/figure.py\", line 2094, in savefig\r\n self.canvas.print_figure(fname, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/backend_bases.py\", line 2075, in print_figure\r\n **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/backends/backend_cairo.py\", line 569, in print_svg\r\n return self._save(fobj, 'svg', *args, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/backends/backend_cairo.py\", line 622, in _save\r\n self.figure.draw(renderer)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/artist.py\", line 50, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/figure.py\", line 1649, in draw\r\n renderer, self, artists, self.suppressComposite)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/artist.py\", line 50, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/axes/_base.py\", line 2628, in draw\r\n mimage._draw_list_compositing_images(renderer, self, artists)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/image.py\", line 138, in _draw_list_compositing_images\r\n a.draw(renderer)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/artist.py\", line 50, in draw_wrapper\r\n return draw(artist, renderer, *args, **kwargs)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/axis.py\", line 1185, in draw\r\n ticks_to_draw = self._update_ticks(renderer)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/axis.py\", line 1023, in _update_ticks\r\n tick_tups = list(self.iter_ticks()) # iter_ticks calls the locator\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/axis.py\", line 967, in iter_ticks\r\n majorLocs = self.major.locator()\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/ticker.py\", line 2128, in __call__\r\n return self.tick_values(vmin, vmax)\r\n File \"/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/ticker.py\", line 2189, in tick_values\r\n have_subs = len(subs) \u003e 1 or (len(subs == 1) and subs[0] != 1.0)\r\nTypeError: len() of unsized object\r\nUncaught exception. Entering post mortem debugging\r\nRunning 'cont' or 'step' will restart the program\r\n\u003e /sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3.7/site-packages/matplotlib/ticker.py(2189)tick_values()\r\n-\u003e have_subs = len(subs) \u003e 1 or (len(subs == 1) and subs[0] != 1.0)\r\n(Pdb) subs\r\narray(100.)\r\n(Pdb) subs.ndim\r\n0\r\n\r\n```\r\n\r\nMaybe `subs` should be converted to a one dimensional array first.\r\n\r\nThe versions of the related programs are:\r\n```\r\nmatplotlib 3.0.2 py37h8a2030e_1 conda-forge\r\nmatplotlib-base 3.0.2 py37h20b835b_1 conda-forge\r\ncairo 1.14.12 h276e583_5 conda-forge\r\npycairo 1.18.0 py37h4d1f301_0 conda-forge\r\npython 3.7.1 h5001a0f_0 conda-forge\r\n```\r\n\r\nThe bug occurred at several plots. However, the creation of the plots is rather complex. Thus I have no minimal example that reproduces the bug for now. If this is necessary, however, I can try to construct one.\r\n","author":{"url":"https://github.com/jor-","@type":"Person","name":"jor-"},"datePublished":"2018-11-14T10:15:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/12806/matplotlib/issues/12806"}
| 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:758d876f-8d0e-2a0a-f943-f93b0db65dae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A00E:35AF44:53802FE:7491BF3:6A550E11 |
| html-safe-nonce | ff0c012a0fdc9045c3921cda36098965314e1911be090c53b62696c8e557fc0d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDBFOjM1QUY0NDo1MzgwMkZFOjc0OTFCRjM6NkE1NTBFMTEiLCJ2aXNpdG9yX2lkIjoiNTkwMTQwODI1OTAzNDkxMDIyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f06f7314f93d786ca8a03e457afc23cad9b653d90484b313ecaae8487c8893c6 |
| hovercard-subject-tag | issue:380626630 |
| 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/12806/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dcfd61fc47a817558e844f4f4bf06f9229cafa2373ed65b262ccab77c4ff1f82/matplotlib/matplotlib/issues/12806 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dcfd61fc47a817558e844f4f4bf06f9229cafa2373ed65b262ccab77c4ff1f82/matplotlib/matplotlib/issues/12806 |
| og:image:alt | Saving a figure with plt.savefig in svg file format using the cairo backend results in a TypeError. The Traceback is: File "/sfs/fs5/home-sh/sunip229/opt/miniconda3/envs/py37_forge_jore/lib/python3... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jor- |
| hostname | github.com |
| expected-hostname | github.com |
| None | 682d273eacb2ac51680c6eb9c0b270f029f7ce74c32090f319083c34497e28a5 |
| 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 | 0f2adbaa4b43ea302b02981f637a782ae92ed6dc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width