Title: RuntimeError: Cannot get window extent w/o renderer · Issue #10874 · matplotlib/matplotlib · GitHub
Open Graph Title: RuntimeError: Cannot get window extent w/o renderer · Issue #10874 · matplotlib/matplotlib
X Title: RuntimeError: Cannot get window extent w/o renderer · Issue #10874 · matplotlib/matplotlib
Description: Bug report Bug summary Matplotlib 2.2.0 seems to introduce regression regarding the use of Agg renderer. In specific cases, get_window_extent() does raise RuntimeError: Cannot get window extent w/o renderer. Code for reproduction #!/usr/...
Open Graph Description: Bug report Bug summary Matplotlib 2.2.0 seems to introduce regression regarding the use of Agg renderer. In specific cases, get_window_extent() does raise RuntimeError: Cannot get window extent w/o...
X Description: Bug report Bug summary Matplotlib 2.2.0 seems to introduce regression regarding the use of Agg renderer. In specific cases, get_window_extent() does raise RuntimeError: Cannot get window extent w/o...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/10874
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RuntimeError: Cannot get window extent w/o renderer","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nMatplotlib 2.2.0 seems to introduce regression regarding the use of `Agg` renderer. In specific cases, get_window_extent() does raise `RuntimeError: Cannot get window extent w/o renderer`.\r\n\r\n**Code for reproduction**\r\n\r\n```python\r\n#!/usr/bin/env python3\r\nimport matplotlib\r\nmatplotlib.use('Agg')\r\nimport matplotlib.pyplot as plt\r\n\r\nfig = plt.figure()\r\nax = fig.add_subplot(111, frameon=True)\r\nax.plot()\r\n\r\n# If the call to draw() below is removed, everything works\r\n# However, this line cases xtick and ytick get_window_extent()\r\n# to raise 'RuntimeError: Cannot get window extent w/o renderer'\r\n# on matplotlib 2.2.0 (tested also on 2.2.2)\r\n#\r\n# Moreover, this works just fine with and without the call to\r\n# draw() below, with matplotlib 2.1.2\r\nplt.get_current_fig_manager().canvas.draw()\r\n\r\nax.set_xlabel(ax.get_xlabel()).get_window_extent()\r\nax.set_ylabel(ax.get_ylabel()).get_window_extent()\r\nfor xtick in ax.get_xticklabels():\r\n xtick.get_window_extent()\r\nfor ytick in ax.get_yticklabels():\r\n ytick.get_window_extent()\r\n```\r\n\r\n**Actual outcome**\r\n\r\n```$ python matplotlib-bug.py\r\nTraceback (most recent call last):\r\n File \"matplotlib-bug.py\", line 22, in \u003cmodule\u003e\r\n xtick.get_window_extent()\r\n File \"/usr/lib/python3.6/site-packages/matplotlib/text.py\", line 920, in get_window_extent\r\n raise RuntimeError('Cannot get window extent w/o renderer')\r\nRuntimeError: Cannot get window extent w/o renderer\r\n```\r\n\r\n**Expected outcome**\r\n\r\nNo exception should be raised. No exception is raised when the code is used with matplotlib 2.1.2.\r\n\r\n**Matplotlib version**\r\n * Operating system: Arch Linux\r\n * Matplotlib version: 2.2.2\r\n * Matplotlib backend (`print(matplotlib.get_backend())`): agg\r\n * Python version: 3.6.4\r\n\r\nInstalled with `pacman -S python python-matplotlib`. Tested against older version of matplotlib by installing them in virtualenv using pip.","author":{"url":"https://github.com/desowin","@type":"Person","name":"desowin"},"datePublished":"2018-03-24T18:45:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/10874/matplotlib/issues/10874"}
| 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:878092e7-a04a-ab3b-0fe2-807123aa58ec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A71C:230906:119C12B:17F809F:6A55C8B6 |
| html-safe-nonce | 195fdacc0a19707f3cd07698a983f19698c0136e452d1c7edcd38058f4b519d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzFDOjIzMDkwNjoxMTlDMTJCOjE3RjgwOUY6NkE1NUM4QjYiLCJ2aXNpdG9yX2lkIjoiMTc3MzQ2MjcxOTIzMzkwMjc3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2673863e5e7dc0ff67c4451f320539ba01392a38569e2a0cabb009e41977f3dd |
| hovercard-subject-tag | issue:308288371 |
| 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/10874/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b0cbd8ad6918cb0c2d044c5d1bdbb001019a6f9ff57cd29053bb98a5355844db/matplotlib/matplotlib/issues/10874 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b0cbd8ad6918cb0c2d044c5d1bdbb001019a6f9ff57cd29053bb98a5355844db/matplotlib/matplotlib/issues/10874 |
| og:image:alt | Bug report Bug summary Matplotlib 2.2.0 seems to introduce regression regarding the use of Agg renderer. In specific cases, get_window_extent() does raise RuntimeError: Cannot get window extent w/o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | desowin |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| 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 | 8f8e1726192df8dce16872ceb503336c12e9ae78 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width