Reputation: 33
I have created a 2D gaussian function for display, the variable gauss (below) is in range of (0, 1). what I want to do is change the default colormap dynamic range from (black, white) to (gray, white)
gauss = np.exp( -(((Xm**2)+(Ym**2)) / (2.0* s**2)) )
p=plt.imshow(gauss, 'Greys_r')
Upvotes: 1
Views: 2921
Reputation: 58865
You can use the color maps Greys_r
in conjunction with the parameters vmin=0.25
and vmax=1.
.
from matplotlib import cm
p = plt.imshow(gauss, cmap=cm.Greys_r, vmin=025, vmax=1.)
Upvotes: 2