Skip to content

[Bugfix] Preserve original DPI in pickled figures to avoid HiDPI doubling (swev-id: matplotlib__matplotlib-23476)#36

Open
casey-brooks wants to merge 1 commit intomatplotlib__matplotlib-23476from
noa/issue-28
Open

[Bugfix] Preserve original DPI in pickled figures to avoid HiDPI doubling (swev-id: matplotlib__matplotlib-23476)#36
casey-brooks wants to merge 1 commit intomatplotlib__matplotlib-23476from
noa/issue-28

Conversation

@casey-brooks
Copy link

Summary

  • preserve the figure's original DPI when restoring pickled figures
  • reapply the stored DPI after recreating pyplot managers
  • add a HiDPI pickle/unpickle regression test

Testing

============================= test session starts ==============================
platform linux -- Python 3.10.19, pytest-9.0.2, pluggy-1.6.0
rootdir: /workspace/matplotlib
configfile: pytest.ini
plugins: timeout-2.4.0, rerunfailures-16.1, xvfb-3.1.1, cov-7.0.0, xdist-3.8.0
collected 183 items

lib/matplotlib/tests/test_pickle.py .................................... [ 19%]
........................................................................ [ 59%]
........................................................................ [ 98%]
... [100%]

============================= 183 passed in 1.44s ==============================

swev-id: matplotlib__matplotlib-23476

Closes #28

@casey-brooks casey-brooks requested a review from a team December 25, 2025 06:19
@casey-brooks
Copy link
Author

Test & Lint Summary

  • LD_LIBRARY_PATH=/root/.nix-profile/lib:/nix/store/qipd93x9gjyiygqk673rd2ssnf8y7jj0-gcc-14.3.0-lib/lib:/nix/store/f8w1i7yisixb9hivzbk0l4ixmf67fjqr-gcc-14.3.0-libgcc/lib:/nix/store/62yvg9afjvmwa8z17arn4giqmjzg2xd2-glibc-2.40-66/lib PYTHONPATH=/workspace/matplotlib/lib MPLBACKEND=Agg .venv/bin/pytest lib/matplotlib/tests/test_pickle.py (183 passed, 0 failed)
  • PYTHONPATH=/workspace/matplotlib/lib .venv/bin/flake8 lib/matplotlib/figure.py lib/matplotlib/tests/test_pickle.py (no issues)

@rowan-stein rowan-stein changed the title Fix DPI doubling after HiDPI pickle reload [Bugfix] Preserve original DPI in pickled figures to avoid HiDPI doubling (swev-id: matplotlib__matplotlib-23476) Dec 25, 2025
Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good—thanks for covering the regression with a dedicated test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants