Skip to content

[Bug]: dpi='figure' option no longer working in savefig #26252

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

Closed
astrofrog opened this issue Jul 4, 2023 · 2 comments
Closed

[Bug]: dpi='figure' option no longer working in savefig #26252

astrofrog opened this issue Jul 4, 2023 · 2 comments

Comments

@astrofrog
Copy link
Contributor

Bug summary

The default dpi='figure' option in savefig no longer appears to work correctly - instead the DPI is a fixed value.

Code for reproduction

import matplotlib.pyplot as plt

fig = plt.figure()
fig.set_dpi(10)
ax = fig.add_subplot(1, 1, 1)
fig.savefig("test_dpi.png", dpi="figure")

Actual outcome

A 100 DPI figure:

test_dpi

Expected outcome

A 10 DPI figure:

test_dpi

Additional information

I bisected this and it appears to have been introduced in #19126 - prior to this, it worked fine.

Operating system

All platforms

Matplotlib Version

Bug first appeared in Matplotlib 3.5

Matplotlib Backend

MacOS X and Agg

Python version

3.11 but seen in other Python versions

Jupyter version

No response

Installation

pip

@astrofrog
Copy link
Contributor Author

astrofrog commented Jul 4, 2023

This might be a duplicate of #24644? If so, sorry for the noise! However I wonder if it makes sense to put in a deprecation warning soon in set_dpi if it's going to be removed, so that other users don't get caught out?

@tacaswell
Copy link
Member

I'm going to close this in favor of tracking this is #24644, but I do not think we should consider Figure.set_dpi as a candidate for deprecation!

@tacaswell tacaswell closed this as not planned Won't fix, can't repro, duplicate, stale Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants