Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: imshow interpolation='none' ignored when using savefig() to PDF format #25575

Copy link
Copy link
Closed
@larrybradley

Description

@larrybradley
Issue body actions

Bug summary

When using imshow with interpolation='none' and then saving the figure to PDF using savefig(), the PDF file output does not match the screen/notebook output. It appears that interpolation is still being applied to the PDF output. This bug is manifested only with 'none' interpolation with PDF filetype output. Setting interpolation to None or 'nearest' gives the correct result with PDF output (and screen/file match). PNG, JPG, and SVG output filetypes all produce the correct results. MWE below.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

data = np.zeros((25, 25))
data[8:16, 8:16] = 100

fig, ax = plt.subplots()
ax.imshow(data, interpolation='none')
fig.savefig('output.pdf')

Actual outcome

Notebook/screen output (correct):

screen

PDF File output (incorrect):
output.pdf

Expected outcome

The output PDF file would not have interpolation applied (matching the screen output).

Additional information

No response

Operating system

macos

Matplotlib Version

3.7.1

Matplotlib Backend

module://matplotlib_inline.backend_inline

Python version

3.11.2

Jupyter version

6.5.3

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.