Skip to content

Severe bug in imshow when plotting images with small values #6394

@astrofrog

Description

@astrofrog

The following minimal example:

import matplotlib
matplotlib.use('Agg')
from astropy.wcs import WCS
from wcsaxes import datasets
import matplotlib.pyplot as plt
hdu = datasets.fetch_msx_hdu()
plt.imshow(hdu.data, vmin=-2e-4, vmax=2e-4)
plt.savefig('image.png')

produces the following output:

image

This appears to be related to the fact the values in the image data are < 1. If I multiply all the values by 1e6, I get something sensible:

plt.imshow(hdu.data * 1e6, vmin=-2e-4, vmax=2e-4)
plt.savefig('image.png')

image

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions