The matshow
docs indicate that the options are mostly just passed to imshow
(docs). Imshow takes arguments vmin
and vmax
that determine the min and max colors as you desire. Let's check out an example:
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
A = np.arange(0,100).reshape(10,10)
plt.matshow(A) # defaults
plt.matshow(A, vmin=0, vmax=99) # same
plt.matshow(A, vmin=10, vmax=90) # top/bottom rows get min/max colors, respectively
Aside:
May I also recommend changing the colormap? eg. cmap='hot'
. Though it is the default (why?), the 'jet'
colormap is almost never the best choice.
x = np.random.randn(1000)
y = np.random.randn(1000)+5
plt.hist2d(x, y, bins=40, cmap='hot')
plt.colorbar()
