Title: [Bug]: backend_cairo set_context() is broken for cairocffi · Issue #26523 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: backend_cairo set_context() is broken for cairocffi · Issue #26523 · matplotlib/matplotlib
X Title: [Bug]: backend_cairo set_context() is broken for cairocffi · Issue #26523 · matplotlib/matplotlib
Description: Bug summary Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 . I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will give that a try. Code for reproduction imp...
Open Graph Description: Bug summary Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 . I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will gi...
X Description: Bug summary Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 . I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I wil...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/26523
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: backend_cairo set_context() is broken for cairocffi","articleBody":"### Bug summary\n\nSaving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 .\r\nI see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will give that a try.\n\n### Code for reproduction\n\n```python\nimport sys\r\nimport matplotlib\r\nfrom matplotlib import pyplot as plt\r\n\r\n\r\ndef main(argv):\r\n matplotlib.use(\"cairo\")\r\n fig, axs = plt.subplots(1, 8, figsize=(8.0, 4.0), facecolor=\"w\", edgecolor=\"k\")\r\n\r\n dump_to = \"whatever.svg\"\r\n plt.savefig(dump_to)\r\n\r\n\r\nif __name__ == '__main__':\r\n main(sys.argv)\n```\n\n\n### Actual outcome\n\n```\r\n File \".../.venv/lib/python3.11/site-packages/matplotlib/backends/backend_cairo.py\", line 484, in _save\r\n self._renderer.set_context(cairo.Context(surface))\r\n File \".../.venv/lib/python3.11/site-packages/matplotlib/backends/backend_cairo.py\", line 99, in set_context\r\n size = rect.width, rect.height\r\n ^^^^^^^^^^\r\nAttributeError: 'tuple' object has no attribute 'width'\r\n\r\n```\n\n### Expected outcome\n\nsavefig should save the fig\n\n### Additional information\n\nthis is with:\r\nmatplotlib==3.7.2\r\ncairocffi==1.6.1\r\nand the brew install of cairo 1.16.0_5\n\n### Operating system\n\nmacOS\n\n### Matplotlib Version\n\n3.7.2\n\n### Matplotlib Backend\n\ncairo\n\n### Python version\n\n3.11.4\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/dmatth","@type":"Person","name":"dmatth"},"datePublished":"2023-08-14T18:43:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/26523/matplotlib/issues/26523"}
| 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:333a9690-85dc-b20c-9a2c-b42598522118 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBFC:313173:F65DAC:14E6738:6A556C29 |
| html-safe-nonce | ccca94f626f74a3acd558d5b33b4e86250f6f19faf4d77a760ddd45142e72478 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkZDOjMxMzE3MzpGNjVEQUM6MTRFNjczODo2QTU1NkMyOSIsInZpc2l0b3JfaWQiOiI3MjYxODM2OTEyMzY0OTczMDk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 03042faa8d53b867b38bb872c0c7521d7c93899f3f77c7cdb138c9dc473f2300 |
| hovercard-subject-tag | issue:1850346125 |
| 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/26523/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7d48645658045efcf0b4baafde6ec50cd3ea13c643abc16882e78a95459d13bf/matplotlib/matplotlib/issues/26523 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7d48645658045efcf0b4baafde6ec50cd3ea13c643abc16882e78a95459d13bf/matplotlib/matplotlib/issues/26523 |
| og:image:alt | Bug summary Saving an SVG via cairocffi this way worked in 3.5.2, but fails in 3.6.x - 3.7.2 . I see though that it's just a cairocffi issue; switching to pycairo seems to work so for now I will gi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dmatth |
| 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 | a90bd2a4a25feb75544d06b89350dcf95d9c46e0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width