Showing np.uint16 images of the form (h,w,3) is broken #2499
Closed
Description
Here is a simple test case:
import matplotlib.pyplot as plt
import numpy as np
A = np.array([np.arange(256,dtype=np.uint16) for _ in xrange(256)])
B = (A<<8)+(255*np.random.random(A.shape)).astype(np.uint16)
B = np.dstack([B,B,B])
plt.imshow(B)
plt.show()
This results in random bits.
The problem is in file lib/matplotlib.cm.py: the conversion to np.uint8
assumes that the input is in 0..1 format.