Title: Refactor mechanism for saving files. by pwuertz · Pull Request #2588 · matplotlib/matplotlib · GitHub
Open Graph Title: Refactor mechanism for saving files. by pwuertz · Pull Request #2588 · matplotlib/matplotlib
X Title: Refactor mechanism for saving files. by pwuertz · Pull Request #2588 · matplotlib/matplotlib
Description: I was trying to fix bbox_inches support for backend_pgf (issue #2586). However, I can't do this properly since tight_bbox needs to know if a backend uses figure.dpi or fixed 72dpi. Right now it derives this information from the file-type, which doesn't really work since different backends may be used for the same type. To fix this problem I need to know which backend is used when saving files in FigureCanvasBase.print_figure(). This required some major changes. I'll break them down to the following steps: Removed print_ methods from FigureCanvasBase and thus a lot of code duplication. Moved print_jpeg and print_tiff to the Agg backend where they are actually implemented. Picked up the rather dormant system for mapping file-types to backends in backend_bases and made it the default reference for finding an appropriate FigureCanvas for a given file type. FigureCanvas is now a canonical alias in each backend. Deferred imports of those are now handled centrally in get_registered_canvas_class(). Default format-to-backend mappings can be added or changed by register_backend(). This is also reflected in the save dialogues of graphical user interfaces. The print_figure() method now works in the following way: Check if the current FigureCanvas supports the requested file type Check if there is a registered FigureCanvas for handling the file type Else, report file format error. Most code parts I modified came from @mdboom and @leejjoon, so I humbly ask you for your opinions.
Open Graph Description: I was trying to fix bbox_inches support for backend_pgf (issue #2586). However, I can't do this properly since tight_bbox needs to know if a backend uses figure.dpi or fixed 72dpi. Right now it...
X Description: I was trying to fix bbox_inches support for backend_pgf (issue #2586). However, I can't do this properly since tight_bbox needs to know if a backend uses figure.dpi or fixed 72dpi. Right no...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/2588
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:8fadf656-0376-c4fe-b4f3-37a77ecfb31d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8F7A:229C6A:152D8C4:1C4366B:6A534F04 |
| html-safe-nonce | 63d435db543c7b0b8c5c732225186930d732c9c2a66186f3c72702ceefb50b20 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjdBOjIyOUM2QToxNTJEOEM0OjFDNDM2NkI6NkE1MzRGMDQiLCJ2aXNpdG9yX2lkIjoiNDE5MTI3MDk4MTc3ODc1NTMzMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0375642603f1e116608a3c6695ba4f7fe15d8a68d00c2bf05efd9fed59772737 |
| hovercard-subject-tag | pull_request:9821841 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/matplotlib/matplotlib/pull/2588/files |
| twitter:image | https://avatars.githubusercontent.com/u/1819283?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1819283?s=400&v=4 |
| og:image:alt | I was trying to fix bbox_inches support for backend_pgf (issue #2586). However, I can't do this properly since tight_bbox needs to know if a backend uses figure.dpi or fixed 72dpi. Right now it... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width