Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add HiDPI physical to logical pixel ratio property #14405

Closed
larsoner opened this issue Jun 1, 2019 · 1 comment · Fixed by #19126
Closed

ENH: Add HiDPI physical to logical pixel ratio property #14405

larsoner opened this issue Jun 1, 2019 · 1 comment · Fixed by #19126
Milestone

Comments

@larsoner
Copy link
Contributor

larsoner commented Jun 1, 2019

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:

    dpi_ratio = 1.
    for key in ('_dpi_ratio', '_device_scale'):
        dpi_ratio = getattr(params["fig"].canvas, key, dpi_ratio)

I 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.

Thoughts? 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.

@ImportanceOfBeingErnest
Copy link
Member

dpi is an annoying problem. There is lots of discussion in #11227 and #11232. So any idea how to get out of that trap are very welcome.

@QuLogic QuLogic linked a pull request Apr 6, 2021 that will close this issue
6 tasks
@QuLogic QuLogic added this to the v3.5.0 milestone Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants