spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.36k stars 1.62k forks source link

Plots look blurred when scaling is enabled on high DPI-screens #22039

Open Chuck321123 opened 6 months ago

Chuck321123 commented 6 months ago

Problem Description

So this problem might be slightly related to #9148 or other issues, but when i make a plot and i explicitly define it to be 300 dpi and change the spyder settings to output 300 dpi the plot output has a really bad quality (looks like 30 dpi). The graphics are equally bad whether the dpi is set to 72, 150 or 300. However, i have found that this comes from me using the 200% scaling option on the windows OS (which was turned on as standard when i bought the pc). When i downscaled to 100% and fired up spyder, the graphs looks very clean and detailed, even at 150 dpi. Might be a good idea to check into this.

What steps reproduce the problem?

Change OS scaling til 200%. Explicitly create a 300 dpi graph and change spyder settings to 150-300dpi. Maybe one also needs a higher dpi screen.

What is the expected output?

That i get the same detailed graphs when i use 200% OS scaling as i do when i only use 100%.

Display: 14" - 2560x1600

Dependencies

# Mandatory:
atomicwrites >=1.2.0             :  1.4.1 (OK)
chardet >=2.0.0                  :  5.2.0 (OK)
cloudpickle >=0.5.0              :  3.0.0 (OK)
cookiecutter >=1.6.0             :  2.6.0 (OK)
diff_match_patch >=20181111      :  20230430 (OK)
intervaltree >=3.0.2             :  3.1.0 (OK)
IPython >=8.13.0,<9.0.0,!=8.17.1 :  8.22.2 (OK)
jedi >=0.17.2,<0.20.0            :  0.19.1 (OK)
jellyfish >=0.7                  :  1.0.3 (OK)
jsonschema >=3.2.0               :  4.21.1 (OK)
keyring >=17.0.0                 :  25.0.0 (OK)
nbconvert >=4.0                  :  7.16.3 (OK)
numpydoc >=0.6.0                 :  1.6.0 (OK)
paramiko >=2.4.0                 :  3.4.0 (OK)
parso >=0.7.0,<0.9.0             :  0.8.3 (OK)
pexpect >=4.4.0                  :  4.9.0 (OK)
pickleshare >=0.4                :  0.7.5 (OK)
psutil >=5.3                     :  5.9.8 (OK)
pygments >=2.0                   :  2.17.2 (OK)
pylint >=2.5.0,<3.1              :  3.0.4 (OK)
pylint_venv >=3.0.2              :  3.0.3 (OK)
pyls_spyder >=0.4.0              :  0.4.0 (OK)
pylsp >=1.10.0,<1.11.0           :  1.10.1 (OK)
pylsp_black >=2.0.0,<3.0.0       :  2.0.0 (OK)
qdarkstyle >=3.2.0,<3.3.0        :  3.2.3 (OK)
qstylizer >=0.2.2                :  0.2.2 (OK)
qtawesome >=1.2.1,<1.3.0         :  1.2.3 (OK)
qtconsole >=5.5.1,<5.6.0         :  5.5.1 (OK)
qtpy >=2.1.0                     :  2.4.1 (OK)
rtree >=0.9.7                    :  1.2.0 (OK)
setuptools >=49.6.0              :  68.2.2 (OK)
sphinx >=0.6.6                   :  7.2.6 (OK)
spyder_kernels >=2.5.1,<2.6.0    :  2.5.1 (OK)
textdistance >=4.2.0             :  4.6.1 (OK)
three_merge >=0.1.1              :  0.1.1 (OK)
watchdog >=0.10.3                :  4.0.0 (OK)
zmq >=24.0.0                     :  25.1.2 (OK)

# Optional:
cython >=0.21                    :  3.0.10 (OK)
matplotlib >=3.0.0               :  3.8.3 (OK)
numpy >=1.7                      :  1.26.4 (OK)
pandas >=1.1.1                   :  2.2.1 (OK)
scipy >=0.17.0                   :  1.12.0 (OK)
sympy >=0.7.3                    :  None (NOK)
ccordoba12 commented 6 months ago

Hey @Chuck321123, thanks for reporting. Quick question to clarify what you said: is only the OS scaling at work when you see blurry plots? Or did you also change the Spyder options for high DPI screens?

Chuck321123 commented 6 months ago

@ccordoba12 No, I havent touched scaling options on Spyder. Its currently set to auto mode. When it comes to dpi in plots (under ipython console -> Graphics) the settings are set to 300 dps.

ccordoba12 commented 6 months ago

I havent touched scaling options on Spyder.

Ok, could you play with those options to see if plots are displayed correctly in Spyder? My guess is that Spyder needs to compensate for the auto-scaling done by Windows so that plots are displayed as expected.

Chuck321123 commented 6 months ago

@ccordoba12 So I've experimented a bit. The OS scaling is constantly set to 200%, but in Spyder when setting to normal mode or manual dpi = 1, the graphs looks very clear, but spyder in general looks a bit zoomed out (because of high dpi). However, setting manual dpi to 2 the graphs have a really bad quality. An idea would maybe be in autoscaling to scale everything expect the graph itself

ccordoba12 commented 6 months ago

An idea would maybe be in autoscaling to scale everything expect the graph itself

Good idea but unfortunately Qt (the graphical toolkit we use) autoscales everything.

Could you post screenshots of how the Plots pane looks with 200% zoom in your OS, and a dpi factor of 1 and 2 in Spyder? That could helps us to better understand how to address this problem.

Chuck321123 commented 6 months ago

@ccordoba12 Sure. Pictures attached below. DPI=2 caused spyder to bug a bit so i couldnt take a screenshot of the whole panel. The first three pictures are with auto. Picture 4-6 are with dpi=1, and picture 7-9 are with dpi=2. Graph dpi is set to 150. Auto1 Auto2 Auto3 DPI1 1 DPI1 2 DPI1 3 DPI2 1 DPI2 2 DPI2 3

mchba commented 5 months ago

I recently got a new laptop (Windows 11, 14", 3072x1920) and am in the exactly same situation as @Chuck321123 . Everything looks nice and sharp, except the plots for some reason... image Has there been any progress on this problem @ccordoba12 ?

ccordoba12 commented 2 months ago

Not yet, we'll try to address it in the coming months.