Title: ENH: Add HiDPI physical to logical pixel ratio property · Issue #14405 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: Add HiDPI physical to logical pixel ratio property · Issue #14405 · matplotlib/matplotlib
X Title: ENH: Add HiDPI physical to logical pixel ratio property · Issue #14405 · matplotlib/matplotlib
Description: When writing figure resizing code to set subplot sizes, HiDPI screens can mess things up if the physical to logical pixel ratio is not accounted for. On the Qt5 backend, there is fig.canvas. _dpi_ratio and on MacOSX there is fig.canvas._...
Open Graph Description: When writing figure resizing code to set subplot sizes, HiDPI screens can mess things up if the physical to logical pixel ratio is not accounted for. On the Qt5 backend, there is fig.canvas. _dpi_r...
X Description: When writing figure resizing code to set subplot sizes, HiDPI screens can mess things up if the physical to logical pixel ratio is not accounted for. On the Qt5 backend, there is fig.canvas. _dpi_r...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/14405
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ENH: Add HiDPI physical to logical pixel ratio property","articleBody":"When writing figure resizing code to set subplot sizes, HiDPI screens can mess things up if the physical to logical pixel ratio is not accounted for. On the Qt5 backend, there is `fig.canvas. _dpi_ratio` and on MacOSX there is `fig.canvas._device_scale` that expose the physical to logical pixel ratio. This leads to code like this:\r\n```python\r\n dpi_ratio = 1.\r\n for key in ('_dpi_ratio', '_device_scale'):\r\n dpi_ratio = getattr(params[\"fig\"].canvas, key, dpi_ratio)\r\n```\r\nI propose adding a `dpi_ratio` or similar property to `fig.canvas` or perhaps directly `fig`. For most backends it would just be `1.` but Qt5Agg and MacOSX canvases could give their actual values.\r\n\r\nThoughts? I can take a stab at this if it seems worthwhile. Pointers as to the preferred name and whether it should live at the `fig` or `fig.canvas` level welcome.","author":{"url":"https://github.com/larsoner","@type":"Person","name":"larsoner"},"datePublished":"2019-06-01T02:19:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/14405/matplotlib/issues/14405"}
| 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:76d3b8b7-85a7-82be-853b-732f2cefb27b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85E4:101A9F:C8564:107AB4:6A52EB27 |
| html-safe-nonce | 9e64d9a5269557782a5920d8c138aa4d4b32bb5a6f1c360bbfd6112c865df5bf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUU0OjEwMUE5RjpDODU2NDoxMDdBQjQ6NkE1MkVCMjciLCJ2aXNpdG9yX2lkIjoiNDc3NTMyMTE5MDQwMjI4ODQyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4afa76fbbefad4a3b31ddd817219b32255d463346c77981389c3007d39219b2e |
| hovercard-subject-tag | issue:451033879 |
| 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/14405/issue_layout |
| twitter:image | https://opengraph.githubassets.com/70a4a846668d5a3e0a926fb18358391725d250f5122a39e9c841603dc11b986b/matplotlib/matplotlib/issues/14405 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/70a4a846668d5a3e0a926fb18358391725d250f5122a39e9c841603dc11b986b/matplotlib/matplotlib/issues/14405 |
| og:image:alt | When writing figure resizing code to set subplot sizes, HiDPI screens can mess things up if the physical to logical pixel ratio is not accounted for. On the Qt5 backend, there is fig.canvas. _dpi_r... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | larsoner |
| 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