Spyder: Low quality matplotlib inline plots on hidpi display

Created on 12 Apr 2019  路  13Comments  路  Source: spyder-ide/spyder

Issue Report Checklist

  • [x] Searched the issues page for similar reports
  • [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • [x] Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • [ ] Could not reproduce inside jupyter qtconsole (if console-related)
  • [x] Tried basic troubleshooting (if a bug/error)

    • [x] Restarted Spyder

    • [x] Reset preferences with spyder --reset

    • [ ] Reinstalled the latest version of Anaconda

    • [x] Tried the other applicable steps from the Troubleshooting Guide

  • [x] Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

What steps reproduce the problem?

  1. set a custom high DPI scalling (default 1.5 or any larger value) in spyder Preferences -> General
  2. plot a line with matplotlib
import numpy as np
from matplotlib import pyplot as pp
pp.figure()
pp.plot(np.arange(100), 'k')
pp.grid()
  1. change inline backend figure format to retina
%config InlineBackend.figure_format = 'retina'
  1. repeat step 2.

What is the expected output? What do you see instead?

Expected the output to be smooth high quality DPI inline plot after change in inline figure format but instead blurry jagged low quality version is displayed as before

spyder-matplotlib-inline-plot

Jupyter notebook run shows correct smooth plot after inline figure format change

jupyter-ipython-inline-plot

Versions

  • Spyder version: 3.3.4
  • Python version: 3.6.7 64-bit
  • Qt version: 5.12.2
  • PyQt version: 5.12.1
  • Operating System name/version: Linux Mint 19.1 Cinnamon 4.0.10

Dependencies

IPython >=4.0     :  7.4.0 (OK)
cython >=0.21     :  0.29.6 (OK)
jedi >=0.9.0      :  0.13.3 (OK)
matplotlib >=2.0.0:  3.0.3 (OK)
nbconvert >=4.0   :  5.4.1 (OK)
numpy >=1.7       :  1.16.2 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
psutil >=0.3      :  5.6.1 (OK)
pycodestyle >=2.3 :  2.5.0 (OK)
pyflakes >=0.6.0  :  2.1.1 (OK)
pygments >=2.0    :  2.3.1 (OK)
pylint >=0.25     :  2.3.1 (OK)
qtconsole >=4.2.0 :  4.4.3 (OK)
rope >=0.9.4      :  0.14.0 (OK)
sphinx >=0.6.6    :  2.0.1 (OK)
sympy >=0.7.3     :  1.4 (OK)
IPython Console Enhancement

Most helpful comment

@dalthviz, please take a look at this one. We need to add a new option in the Inline backend section of our preferences called

[ ] Display images in high resolution

And pass that option to the kernel.

All 13 comments

@dalthviz, please take a look at this one. We need to add a new option in the Inline backend section of our preferences called

[ ] Display images in high resolution

And pass that option to the kernel.

using Kubuntu 18.10 installation there is no such a problem even with default png backend inline format
Python 3.6.7 64-bit | Qt 5.12.2 | PyQt5 5.12.1 | Linux 4.18.0-17-generic

Then I'd say it's a Qt issue and not an Spyder one.

Display images in high resolution

If this is still a correction needed, why not make it a default (instead of adding the option?)

Because in non-HDPI screens plots will look huge.

Because in non-HDPI screens plots will look huge.

Got it thanks!

Is there an overall High DPI setting for spyder? Could we link to that one?

There's what Rafa added in

Preferences > General > Screen resolution

But linking both things (a change in that option with a change in the inline backend) is not work for Spyder 3.

Should we leave this for Spyder 4? It's not that critical.

Should we leave this for Spyder 4? It's not that critical.

Yes, I believe is the right place to fix it.

Then I'd say it's a Qt issue and not an Spyder one.

There are similar issues with Gwenview PNG images opened in Kubuntu 18.10 HIDPI monitor with desktop scaled to fractional scale as in Spyder running on Mint 19.1. PNG images in Gwenview once opened looked exactly blurry and jagged and that issue is known and reported.

@goanpeca, do you need to activate our option in

Preferences > General > Screen resolution

in your Retina Display Mac for things to look good there?

That's to know if Qt adjusts automatically to HiDPI in some cases (like macOS).

If you don't need to activate that option, then we really need to add another option to the console preferences (as proposed at the beginning) to tell the kernel that Spyder is running in a HiDPI screen.

Some useful links:

Notes:

  • Add support to run %config InlineBackend.figure_format = <option>.
  • Add an option in the Plots plugin to enable a certain figure format (probably the option in the preferences of the IPython Console should be migrated to not have multiple preferences for the same thing - format figure of the inline backend).
  • Probably, when setting the figure format option in the Plots plugin, we should ask if the format figure preference needs to be applied to all the available consoles or just the current one.

@dalthviz, the work you're planning to do to solve this one could be unnecessary if PR #12219 is merged in the future. So please take a look at that work before starting this one.

Was this page helpful?
0 / 5 - 0 ratings