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

Initial HiDPI support for qt5agg backend by piannucci · Pull Request #6389 · matplotlib/matplotlib · GitHub

Repository navigation

Initial HiDPI support for qt5agg backend - #6389

Closed
piannucci wants to merge 1 commit into
matplotlib:masterfrom
piannucci:qt5agg_retina
Closed

piannucci wants to merge 1 commit into
matplotlib:masterfrom
piannucci:qt5agg_retina

Conversation

Copy link
Copy Markdown
Contributor

Here's what needs to be done to get HiDPI support working with qt5agg. Not sure if you want to do it this way or some other way.

Copy link
Copy Markdown
Member

The changes in qt5_backend.py seem un-related?

tacaswell added this to the 2.1 (next point release) milestone May 9, 2016

Copy link
Copy Markdown

On OSX 10.11 I get the following error:

File "/Users/marius/Library/Python/3.5/lib/python/site-packages/matplotlib/backends/backend_qt5.py", line 253, in mouseEventCoords
    x,y = self.mouseEventCoords(pos)
RecursionError: maximum recursion depth exceeded

piannucci commented May 13, 2016 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Whoops. I typo'd that pretty badly when building the commit. The changes in the two files are related: if the dpi_ratio is not 1, then mouse events need to be mapped between device and pixel coordinates in order for the rest of the event stack to behave correctly.

Fixed some PEP8 violations.

fariza commented May 16, 2016

Copy link
Copy Markdown
Member

Can this be done in a more general way? something that will be useful for all backends?

What about adding a FigureCanvasBase.get_device_pixel_ratio or something like that (returns 1 by default).
And the basic multiplication done in the FigureCanvasBase.xxxEvent instead that in the specific backend?

Copy link
Copy Markdown
Contributor

It would be great to get a fix in for this, even if it is not a solution that is applicable to all backends. Currently for glue, everything looks nice and crisp, except the Matplotlib canvas, which looks pixellated (on a retina display).

adrn commented Aug 28, 2016

Copy link
Copy Markdown
Contributor

Any progress on this? @astrofrog are you using the MacOSX backend in the meantime?

Copy link
Copy Markdown
Member

@adrn This seems to have stalled. Can you test if this

Copy link
Copy Markdown
Member

Sorry for partial message (UI fail: start typing, decide to 'powercycle' to re-trigger CI, close and post partial message)

@adrn Can you test if this works for qt5 + hidpi?

I could be convinced that this should be backported for 2.0 if it gets done in the next week or so.

tacaswell modified the milestones: 2.0 (style change major release), 2.1 (next point release), 2.0.1 (next bug fix release) Aug 28, 2016

mretegan commented Aug 30, 2016 •
edited
Loading

Copy link
Copy Markdown

@adrn For applications that embed the Matplotlib window, the MacOSX backend is not an option.

The only standing issue with this is the dpi used in the figure; it is still the default 100, even for Retina display. Maybe this should be scaled by devicePixelRatio? Other than that everything looks really nice and crisp. A print screen of a small app that uses the backend and the code used to make it. It would be really nice to have this in v2.0.

Copy link
Copy Markdown
Member

I think we should push for getting this into 2.0. I will see what I can do

adrn commented Aug 30, 2016

Copy link
Copy Markdown
Contributor

@tacaswell I'll also take a look at this today.

Copy link
Copy Markdown
Member

@adrn Can you coordinate with @jenshnielsen ?

Copy link
Copy Markdown
Member

@adrn if you have time to work on it that is much appreciated, I will then make sure it is reviewed and merged.

adrn commented Aug 30, 2016

Copy link
Copy Markdown
Contributor

@jenshnielsen Will try -- I'm at astrohackweek and will likely spend some hack time on this.

Copy link
Copy Markdown
Member

Great if you need any assistance please just ask

adrn commented Aug 30, 2016

Copy link
Copy Markdown
Contributor

Alright here's what I see. I compares (this PR + qt5agg) and (this PR + tkagg) using this code:

import numpy as np
import matplotlib as mpl
# mpl.rcParams['backend'] = 'tkagg'
# mpl.rcParams['backend'] = 'qt5agg'
import matplotlib.pyplot as plt

with plt.style.context('classic'):
    x = np.random.normal(size=128)
    y = np.random.normal(size=128)

    plt.scatter(x, y)
    plt.show()

So it looks like the fix here works, but the fonts, markers, ticks, etc. need to be scaled by the pixel ratio?

Copy link
Copy Markdown
Member

I think you just need to up the DPI passed to the renderer?

Copy link
Copy Markdown
Member

#5383 which adds hidpi support to the notebook backend may give you some clues on how to do that.

QuLogic mentioned this pull request Nov 24, 2016
QuLogic assigned QuLogic and unassigned jenshnielsen Nov 24, 2016

QuLogic commented Jan 4, 2017

Copy link
Copy Markdown
Member

Finished in #7507.

QuLogic closed this Jan 4, 2017
QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Jan 4, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL