Title: Figure resize when saving a plot · Issue #8736 · matplotlib/matplotlib · GitHub
Open Graph Title: Figure resize when saving a plot · Issue #8736 · matplotlib/matplotlib
X Title: Figure resize when saving a plot · Issue #8736 · matplotlib/matplotlib
Description: Bug report Bug summary The print_figure function in the FigureCanvasBase class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the original. Setting the dpi invokes a property fu...
Open Graph Description: Bug report Bug summary The print_figure function in the FigureCanvasBase class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the origina...
X Description: Bug report Bug summary The print_figure function in the FigureCanvasBase class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the ori...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/8736
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Figure resize when saving a plot","articleBody":"### Bug report\r\n\r\n**Bug summary**\r\n\r\nThe `print_figure` function in the `FigureCanvasBase` class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the original. Setting the dpi invokes a property function, `_set_dpi` that calls the figure's `set_size_inches` method, which then triggers a resize of the figure manager. \r\n\r\nThis resize is not evident when I use the standard Pyplot commands within a Qt console, presumably because the plot size doesn't change. However, I have embedded the Matplotlib figure in a PyQt GUI where I don't have the toolbar in the same widget, and it causes a noticeable size change for a fraction of a second before the second dpi reset restores the old size.\r\n\r\n**Possible solution**\r\n\r\nI would like to suggest that the `FigureCanvasBase` `print_figure` function should not invoke the dpi property, but set and then reset the figure's hidden variable, `_dpi`, which will not trigger the redundant canvas resize. I can submit a pull request, but I wanted to check if there would be side effects.\r\n\r\n**Matplotlib version**\r\n * Matplotlib Version: 2.0.2\r\n * Operating System: Mac OS 10.12.5\r\n * Python Version: 2.7.11\r\n * PyQt 4.8.7","author":{"url":"https://github.com/rayosborn","@type":"Person","name":"rayosborn"},"datePublished":"2017-06-09T18:17:18.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/8736/matplotlib/issues/8736"}
| 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:cac08a15-74e1-31d8-8025-3829cacb15e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBCC:25EC2E:1321324:196D2CF:6A5342AA |
| html-safe-nonce | 57f1dfb59ef7fa87ea1024bbf9846c3b2780fe8e0b496d1d77758f57062fbccb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkNDOjI1RUMyRToxMzIxMzI0OjE5NkQyQ0Y6NkE1MzQyQUEiLCJ2aXNpdG9yX2lkIjoiODAxNDMyNjQ2NTUwMzExNzk5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9cd94107329b14b14d098d937023e9b304ea18ed131181def00edfdda58f0689 |
| hovercard-subject-tag | issue:234902335 |
| 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/8736/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a09afcbb0b6cfdda8fa2d1d7c75b5eb68150cd08f8425c0f8eeca17b89f69c9/matplotlib/matplotlib/issues/8736 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a09afcbb0b6cfdda8fa2d1d7c75b5eb68150cd08f8425c0f8eeca17b89f69c9/matplotlib/matplotlib/issues/8736 |
| og:image:alt | Bug report Bug summary The print_figure function in the FigureCanvasBase class records the current figure's dpi, sets it to the requested dpi for the saved figure, and then resets it to the origina... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rayosborn |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width