Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed as not planned
@astrofrog

Description

@astrofrog

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions