Python: display a matrix with negative and positive values

image, matlab, python

Solution

Looks like it gets scaled by default using matplotlib's `imshow`:

import numpy as np
import matplotlib.pyplot as plt

x = np.array([[1.0,2.0], [-3.0,-2.0]], dtype='float')

plt.imshow(x, interpolation='none')
plt.colorbar()
plt.show()

Problem

I have a matrix `m` with positive and negative values. I would like to visualize this matrix in Python. In MATLAB, I can display this matrix so that the most negative value gets mapped to 0 while the most positive value gets mapped to 255 through using `imshow(m, []);`. How can I do this equivalently under python?

Original source

Related problems