FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve resolution of canvas on HiDPI with PyQt5 backend · Issue #4977 · matplotlib/matplotlib · GitHub

Repository navigation

Improve resolution of canvas on HiDPI with PyQt5 backend #4977

Closed

Description

One of the nice things about Qt5 (as far as I understand) is that it provides better support for HiDPI (retina) displays, but at the moment it doesn't look like Matplotlib is taking advantage of this:

PyQt4:

PyQt5:

MacOS X:

Note that MacOS X does take advantage of the HiDPI display, though the icons are still low-res

Interestingly, the low resolution pixels in the PyQt5 example look crisper which suggests that it might be rendered at HiDPI but the content of the canvas is low resolution.

So just to clarify, I think there are two issues here:

Activity

  1. WeatherGod commented on Aug 22, 2015

    Member

    Is this in master or the latest release? I know some work has been done at
    least in the macosx backend, and I could have sworn we fixed a few retina
    issues in other backends. Not to say that we support retina everywhere, but
    rather that we fixed some rendering issues on retina displays (things were
    showing up a 4x the normal size and such).

    As for the icons, it might be that they aren't high resolution enough to
    really fare much better?

    On Sat, Aug 22, 2015 at 10:03 AM, Thomas Robitaille <
    notifications@github.com> wrote:

    One of the nice things about Qt5 (as far as I understand) is that it
    provides better support for HiDPI (retina) displays, but at the moment it
    doesn't look like Matpotlib is taking advantage of this:

    PyQt4:

    [image: pyqt4_big]
    https://cloud.githubusercontent.com/assets/314716/9424283/1b84bf52-48e7-11e5-8e52-e8b45b9ae21c.png

    PyQt5:

    [image: pyqt5_big]
    https://cloud.githubusercontent.com/assets/314716/9424285/1ff6a532-48e7-11e5-8a05-6585732f1b9b.png

    Interestingly, the low resolution pixels in the PyQt5 example look crisper
    which suggests that it might be rendered at HiDPI but the content of the
    canvas is low resolution.

    —
    Reply to this email directly or view it on GitHub
    #4977.

  2. astrofrog commented on Aug 22, 2015

    ContributorAuthor

    @WeatherGod - this is in master. The MacOS X backend does look nicer, though the icons there are still low DPI. I've updated the issue above to make this clearer and made the screenshots larger to show part of the canvas.

    I'm going to open a separate issue for the icons to make sure this issue is about PyQt5 [update: see #4978]

  3. changed the title [-]Improve resolution of output on HiDPI with PyQt5 backend[/-] [+]Improve resolution of canvas on HiDPI with PyQt5 backend[/+] on Aug 22, 2015
  4. tacaswell commented on Aug 22, 2015

    Member

    As I understand it, part of the difficulty here is that there seem to be several layers trying to compensate for this issue.

    On my laptop (linux and qt4agg) which has a stupidly high resolution screen the default settings render so that text is almost unreadable, but setting rcparams['figure.dpi'] = 150 seems to work well. Why this isn't the actual dpi of the screen or if this will work on mac + qt5 I don't know.

    I am pretty sure that under the hood of the *Agg backends we are copying from the Agg pixel buffer to what ever the backends version of a screen buffer is (so we have per-pixel control and the gui doesn't do any interpolation). We really should sort out how to query the gui frameworks for things like screen DPI and update the figure.dpi parameter accordingly.

  5. added this to the milestone on Aug 22, 2015
  6. astrofrog commented on Aug 22, 2015

    ContributorAuthor

    Just for the record, if I set rcparams['figure.dpi'] = 150 on Mac with Qt5, it just makes the figure larger rather than actually improving the resolution.

  7. mdehoon commented on Aug 23, 2015

    Contributor

    For the MacOSX backend, it's easy to fix the button icon resolution, provided that the image is available at a high enough resolution (either as a .png or as a .pdf).

  8. mjsu commented on Sep 9, 2015

    It would be great to fix this. I wish I had the skills to do so.

  9. astrofrog commented on Sep 13, 2015

    ContributorAuthor

    @tacaswell - so just to make sure I understand, on Linux with PyQt5, if you do:

    rcParams['figure.dpi'] = 150
    plt.figure()
    plt.subplot(1,1,1)

    you end up with a figure at full DPI resolution with smooth text, and the figure is no larger than it is with the lower DPI? On Mac this just makes the figure bigger and the DPI stays the same.

    I looked at the backend code for Qt5 but couldn't see where there might be a Mac/Linux difference.

    By the way, this is also the case on other Mac backends - changing the DPI just changes the figure size, which seems... wrong. Is that a bug?

  10. tacaswell commented on Sep 14, 2015

    Member

    No, on a high dpi screen my figures show up as tiny, increasing the DPI makes the font readable. I think that this is a result of my system not trying to compensate for the high dpi by bumping up the mpl dpi, it comes closer to what it really is, so a 5x6 figure really is 5x6 on the screen.

  11. astrofrog commented on Sep 14, 2015

    ContributorAuthor

    @tacaswell - ok, so it seems the machinery should be in place to get high resolution canvases, but it is just buggy on Mac, right?

    Can anyone confirm whether they see the same behavior as me on Mac?

  12. astrofrog commented on Sep 14, 2015

    ContributorAuthor

    I think I found a path to a fix. I can work on it during the week but if anyone else knows the exact fix, please let me know!

  13. mjsu commented on Sep 14, 2015

    @astrofrog I get the same behaviour as you using the Qt5Agg backend and that rcParams. If I use the MacOSX backend with dpi=150 the figure is also bigger (and resolution is good), but the aspect ratio of the enlarged figure is different to the Qt5Agg.

  14. astrofrog commented on Sep 19, 2015

    ContributorAuthor

    I've been making progress on this, but in the process got very confused about the DPI issue and the fact that on most computers I've tried, DPI doesn't mean actual DPI but is just a multiplicative factor for figure size. So basically the question is whether a figure with a DPI of 80 should look crisp by default with PyQt5. I've sent a message for discussion to the dev list: https://mail.python.org/pipermail/matplotlib-devel/2015-September/000097.html

  15. johan12345 commented on Mar 17, 2016

    Contributor

    On Windows, using the TkAgg backend, Both the plotting canvas and the icons in the toolbar have low resolution, too :(
    I am using the current 1.5.1 release, Python 3.5.1 and Windows 10.

  16. piannucci commented on May 9, 2016

    Contributor

    Here's a patch. Doesn't fix the icons, just the plots. #6389

  17. QuLogic commented on Jan 4, 2017

    Member

    Fixed by #6387 / #7507.

  18. modified the milestones: , on Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL