X Tutup
Skip to content

Regression in imshow #7373

@alfredobrent

Description

@alfredobrent

The imshow command in 2.0.0b4 and current master (07adcde) don't export images with colormaps correctly. The colormap is not scaled correctly:

imshow_git

This bug is not present in 1.5.1:

imshow_1 5 1

Some precisions:

  • version 1.5.1 from ubuntu 16.04 repository
  • git master (07adcde) #installed from source on ubuntu 16.04

Code to reproduce this behavior:

#!/usr/bin/env python2.7
import matplotlib
import matplotlib.pyplot as plt
import numpy as np

print(matplotlib.__version__)

cmap = plt.cm.jet

# coordinates
bbox=20
resolution = 100

xcoords = np.linspace(0, bbox, resolution)
ycoords = np.linspace(-bbox, bbox, 2*resolution)
    
# evaluate
xnb = len(xcoords)
ynb = len(ycoords)
dat = np.zeros((ynb,xnb))
for i in range(xnb):
    for j in range(ynb):
        dat[j][i] = np.sqrt(xcoords[i]**2+ycoords[j]**2)
# export to png
plt.imsave("imshow.png", dat, cmap=cmap, vmin=0, vmax=None)

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup