-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Initial HiDPI support for qt5agg backend #6389
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
Conversation
The changes in |
On OSX 10.11 I get the following error:
|
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. |
Can this be done in a more general way? something that will be useful for all backends? What about adding a |
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). |
Any progress on this? @astrofrog are you using the MacOSX backend in the meantime? |
@adrn This seems to have stalled. Can you test if this |
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. |
@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. |
I think we should push for getting this into 2.0. I will see what I can do |
@tacaswell I'll also take a look at this today. |
@adrn Can you coordinate with @jenshnielsen ? |
@adrn if you have time to work on it that is much appreciated, I will then make sure it is reviewed and merged. |
@jenshnielsen Will try -- I'm at astrohackweek and will likely spend some hack time on this. |
Great if you need any assistance please just ask |
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? |
I think you just need to up the DPI passed to the renderer? |
#5383 which adds hidpi support to the notebook backend may give you some clues on how to do that. |
Finished in #7507. |
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.