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

imshow doesn't properly display some images #10072

Copy link
Copy link
@jbhopkins

Description

@jbhopkins
Issue body actions

Bug report

Bug summary
When using imshow with larger images, you lose pixel resolution for low intensity pixels with lots of nearby zeros (not sure if the intensity or nearby zeros are relevant, or just relative isolation of the pixel). It's like they're being interpolated away, even if interpolation is set to nearest. This is new behavior in version 2.1.

Code for reproduction
Use the attached npy file, which is an image referenced in this test script.

import matplotlib.pyplot as plt
import numpy as np

img = np.load('test_image.npy')

#Display full image
plt.imshow(img, interpolation = 'nearest')
plt.clim(0, 5)
plt.show()

#Display part of image
plt.imshow(img[200:400,500:700], interpolation = 'nearest')
plt.clim(0, 5)
plt.show()

Actual outcome
Using matplotlib 2.1.1:
Screenshot from the display of full image (first plot in code above):
full_plot_2p1

Using the zoom tool to zoom in on a region when the full image is plotted:
zoom_full_plot_2p1

Plotting roughly the same zoom region initially (second plot in code above):
partial_plot_2p1

Expected outcome
It should all look like the third image. Here's the output when the same code is run in version 2.0.2
Screenshot from the display of full image (first plot in code above):
full_plot_2p0

Using the zoom tool to zoom in on a region when the full image is plotted:
zoom_full_plot_2p0

Plotting roughly the same zoom region initially (second plot in code above):
partial_plot_2p0

Matplotlib version

  • Operating system: macOS 10.12.6
  • Matplotlib version: 2.1.1 (broken) and 2.0.2 (working)
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 2.7.12
  • Other libraries: numpy version 1.13.3

All libraries are installed through conda, using the standard channel. This includes both versions of matplotlib (2.1.1 and 2.0.2).

Numpy file with image data:
test_image.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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.